Home > Article > Backend Development > C program prints "Hello World!" without using semicolon
Let us see how to write a C program in which we can print the text "Hello World" without using any Text can be written simply by using printf("Hello World") in the main function. But there is a semicolon at the end of the line. To avoid semicolons we can use some tricks The same printf() statement can be used in an if conditional statement. Since the printf() statement returns the length, you can do text, so it is non-zero and therefore the if statement will be true. So the text will be written in Translation: The length of the text is non-zero, so the if statement will be true. So the text will be written screen.
#include<stdio.h> main() { if(printf("Hello World")) { } }
Hello World
The above is the detailed content of C program prints "Hello World!" without using semicolon. For more information, please follow other related articles on the PHP Chinese website!