Ok lets say
name is a char and I typed Bruce
what value would I get?
strcmp(name,"Bruce")
1 or 0?
and if it is one explain why this code source doesn't work
Code:#include <stdio.h> #include <stdlib.h> main() { char name[21]; int age; puts("Are you the chosen one?"); printf("Please ENTER your first name: "); gets(name); printf("Please enter your age: "); scanf("%d", &age); if (age >= 18 && strcmp(name,"Bruce") == 1) printf("You are the CHOSEN ONE.\n"); else puts("Sorry your not the chose one."); fflush(stdin); getchar(); }



LinkBack URL
About LinkBacks


