The only syntax error I get with a copy/paste of your code is different characters for " than my compiler was expecting. Try the following:
#include <stdio.h>
int main()
{
char name[20];
char color[20];
printf("What is your name?");
scanf("%s",name);
printf("What is your favorite color?");
scanf("%s",color);
printf("%s's favorite color is %s\n",name,color);
return(0);
}
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
I think I know what I did wrong. Since the scanf is not going to put text on the page, there is no need \n on there. Thanks :)
On top of not being related to your original stated problem, your original code didn't use '\n' in either scanf format string. So if the problem and code were both wildly different from reality, what kind of help were you expecting to receive? :icon_rolleyes:
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401