Small example code to show the problem.
#include <stdio.h>
#include <stdio.h>
#include <ctype.h>
#include <strings.h>
int main (int argc,char *argv[]) {
printf("enter a sentence: ");
char c;
while((c=getchar())!=EOF){
if(isspace(c)) continue;
else putchar(c);
}
return(0);
}
compiles runs as expected.
now I wanna switch the block to ternery
while((c=getchar())!=EOF) isspace(c)?continue:putchar(c);
error when compiling: F:\tests\main.c|12|error: expected expression before 'continue'|
isspace is returning int either 0 or integer...I cant get why everything works without ternery and gives this error with ternery.
thanks.