In C programming language, semicolon (;) is used to terminate a statement. However, it is possible to use the printf() function without using semicolon by placing the function call inside a code block and using a compound statement. Here is an example:
C
#include <stdio.h>
int main() {
if (printf("Hello, world!\n")) {
// do something else
}
return 0;
}
In this example, the printf() function call is inside an if statement, and the code block following the if statement serves as a compound statement that replaces the semicolon. When the program is executed, the message “Hello, world!” will be printed on the screen, followed by a newline character. The return value of printf() is used as the condition for the if statement, which will evaluate to true if the message is printed successfully.