Works for me.
Code:
#include <stdio.h>
#define STR1 "CORRECT"
#define STR2 "WRONG"
void foo( ) {
char ch = 'A', ch2 = 'a';
char *result = ch == ch2 ? STR1 : ((ch == (ch2 - 32) ? STR1 : STR2));
printf("Result: %s\n", result);
}
void bar() {
char ch = 'a', ch2 = 'A'; // swapped
char *result = ch == ch2 ? STR1 : ((ch == (ch2 - 32) ? STR1 : STR2));
printf("Result: %s\n", result);
}
void baz() {
char ch = 'A', ch2 = 'b'; // different
char *result = ch == ch2 ? STR1 : ((ch == (ch2 - 32) ? STR1 : STR2));
printf("Result: %s\n", result);
}
int main()
{
foo();
bar();
baz();
return 0;
}
It's hard to say what you're up to when even your single line of code won't compile properly.
Code:
foo.c: In function ‘main’:
foo.c:9:70: error: expected ‘)’ before ‘;’ token
char *result = ch == ch2 ? STR1 : ((ch == (ch2 - 32) ? STR1 : STR2);
^
And it's nothing to do with whether you #include things or not.
If you're still stuck, you need to post actual code you compiled and ran.