#include <stdio.h>
main()
{
char name[30];
int age;
printf("Please enter your name: ");
scanf("%s", name);
printf("How old are you %s: ", name);
scanf("%d", age);
if (strcmp(name, "Abs") == 1 && age == 25)
printf("You are the CHOSEN one!\n");
else
printf("You are a wankstain!\n");
fflush(stdin);
getchar();
}
The if statement seems to ignore the right answer, i have also tried to put the age in brackets to no avail.
strcmp
. You been to check for zero.scanf
- it does return a value that needs to be checked.stdin
.(see http://linux.die.net/man/3/strcmp and http://linux.die.net/man/3/scanf)