is it possible to change the value held by a char array using the ternary operator?
This is what i have tried, but the output is not what im expecting:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
int a;
char str [10];
printf("Enter a word:\n");
scanf("%s",&str); // user enters a word here, say the word "bad".
printf("Enter a number:\n");
scanf("%d",&a);
printf("%s\n",str);
// This is were im having the problems, im getting a compile error for incompatible types
str = a>1 ? "greater":"false";
printf("%s\n",str);
How can i get around this problem? I knew to C, and im trying to learn it before progressing to C++