How would you return a space from say an if else statement?
Code:int x; char ' '; if (x>0) winner = 'x' printf("winner is %d\n",winner); else winner = ' '; printf("winner is %d\n", winner);
How would you return a space from say an if else statement?
Code:int x; char ' '; if (x>0) winner = 'x' printf("winner is %d\n",winner); else winner = ' '; printf("winner is %d\n", winner);
First, this means nothing:
For the function, you would declare the function as returning a char, and then in the function, return the char:Code:char ' ';
Code:char foo() { return 'b' ; }
Mainframe assembler programmer by trade. C coder when I can.
if if/else or other block contains more than 1 statement you have to use braces, for one statement blocks it is recomended to use braces
Code:if(x) { ch = ' ' ; } else { ch = 'x'; ch++; }
All problems in computer science can be solved by another level of indirection,
except for the problem of too many layers of indirection.
– David J. Wheeler