Print "hello" without using semicolon

Ram Pothuraju

 #include <stdio.h>

int main()


    if (printf("hello"))



    return 0;


in this program, we use the printf() function to print "hello", and we enclose it in an if statement that checks whether the return value of printf() is non-zero. Since the printf() function returns the number of characters printed, which in this case is non-zero, the if statement is true and the code block is executed, even though it is empty.

This program will print "hello" without using a semicolon. However, it is not recommended to write code like this in practice, as it can be confusing and difficult to read. The use of semicolons is a fundamental aspect of C syntax, and should be used as appropriate to make code more clear and maintainable.

Post a Comment


Post a Comment (0)