Here is the normal code :
if(a==b)
printf("equal");
else if(a>b)
printf("bigger");
else
printf("smaller");
My teacher want to change if/else to this structure:
printf("%s",a>b?"bigger":"smaller")
of course, this just a simple and standard. and I don’t know how to apply this to above code to replace if/else.
It’s not generally a good idea to use nested conditional operators, but it can be done: