I'm new to coding and this is the first code I've tried by myself. I keep getting this error [Warning] comparison between pointer and integer. Can anyone help me?
As you can see I have unused variables. I can't continue until i get this figured out.
Code:
#include <stdio.h> #include <conio.h> int main(void) { int sum; int sum2; int sum3; int sum4; int sum5; char name; char france; char texas; char canada; char mexico; char houston; printf("What is your name?"); scanf("%s", &name); printf("Hello, %s.\n", &name); getch(); printf("%s, please answer the following questions: 1+1=", &name); scanf("%d", &sum); if (sum == 2) {printf("Correct. Now try this one. 6+11=");} else {printf("Incorrect. The answer was 2. Now try this one. 6+11=");} scanf("%d", &sum2); if(sum2 == 17) {printf("Correct. Now try this one. 8+2=");} else {printf("Incorrect. The answer was 17. Now try this one. 8+2=");} scanf("%d", &sum4); if (sum4 == 10) {printf("Correct. This is the last one. I bet you wont get this one. 999+999=");} else {printf("Incorrect. The answer was 10. This is the last one. I bet you wont get this one. 999+999=");} scanf("%d", &sum5); if(sum5 == 1998) {printf("Correct. Wow, you are smart.\n What is the capital of France?");} else {printf("It was 1998...Told you you wouldn't get it.\n What is the capital of France?");} scanf("%s", &france); if (france == "paris") {printf("Nice. Try this one. What is the capital of Texas");} else {printf("Sorry but %s was wrong.The correct answer was Paris. Try this one. What is the capital of Texas", france);} getch(); }
Comment