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
Post a Comment