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 -

reflection - How to access the object-members of an object declaration in kotlin -

php - Doctrine Query Builder Error on Join: [Syntax Error] line 0, col 87: Error: Expected Literal, got 'JOIN' -