c - Can't see the error -


for reason, can't see code faulty.

#include <stdio.h> #include <stdlib.h>  int main() {     int age;      printf("how old \n");      scanf("%s", &age);      if (age > 18){         printf("you may enter \n");     }  /* above program runs, prints "you may enter"*/   if (age < 18){         printf("nothing see here \n");     }      return 0; } 

/thanks/

hint:

$ gcc main.c                                                                    main.c: in function ‘main’: main.c:10:11: warning: format ‘%s’ expects argument of type ‘char *’, argument 2 has type ‘int *’ [-wformat=]      scanf("%s", &age);            ^ $  

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -