Home >Backend Development >C++ >Write a C program that prints 'Tutorials Point' without using semicolons
To print any string without using semicolon, we need to understand how standard output works and why semicolon is used.
The semicolon is an end-of-line statement that tells the program that the line ends here. The standard print statement printf used here is a method of the standard io library. Let’s take a closer look at the printf() method.
int printf(const char *format , ...)
This method returns an integer and has a set of arguments format and … . The format is a string that is printed in the output screen. And the … is the additional number of arguments that are given to the function based on the string.
The funnctions return the total number of character that is to be printed on the screen.
Using this we can find ways to bypass the use of end of line statement while printing the statement. We can use some statements that do not require the end of LINE statement to execute like the for loop. We can use this to print are set a statement without using the semicolon.
There are several methods by which we can print statement without using the semicolon;
#include<stdio.h> int main() { if (printf("Tutorials point") ) { } }
#include<stdio.h> int main() { switch (printf("Tutorials point") ) { } }
#include<stdio.h> int main() { while (printf("Tutorials point") ) { } }
#include<stdio.h> #define Out printf("Tutorials point") int main() { switch (out) { } }
The above is the detailed content of Write a C program that prints 'Tutorials Point' without using semicolons. For more information, please follow other related articles on the PHP Chinese website!