0
How to print a statement without using any semicolon in C program???
5 Answers
+ 3
not possible. semicolons rule the programming world
+ 2
@alvaro that would not work, as printf () is not a boolean expression, so it can not be evaluated to true or false
+ 1
Try writing each sentence in an if sentence.
if(printf("Hi there")) {}
Not very useful, though.
Oh BTW, it's not my idea... just google it and you'll find a ton of alternatives.
+ 1
It works actually, because if(printf(...)) makes use of the fact that printf is a function that returns an int value, which can be coerced into a boolean value, and thus interpreted by the if clause:
"[printf] Return Value
If successful, the total number of characters written is returned. On failure, a negative number is returned."
https://www.tutorialspoint.com/c_standard_library/c_function_printf.htm
- 1
it is not possible for u to do it
it will show syntax error