0

How to print a statement without using any semicolon in C program???

13th Apr 2017, 2:54 PM
sagar chauhan
sagar chauhan - avatar
5 Answers
+ 3
not possible. semicolons rule the programming world
13th Apr 2017, 3:11 PM
Edward
+ 2
@alvaro that would not work, as printf () is not a boolean expression, so it can not be evaluated to true or false
13th Apr 2017, 3:44 PM
Edward
+ 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.
13th Apr 2017, 3:40 PM
Álvaro
+ 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
13th Apr 2017, 4:14 PM
Álvaro
- 1
it is not possible for u to do it it will show syntax error
13th Apr 2017, 3:32 PM
Rahul Sonia
Rahul Sonia - avatar