Printing Hello Without using semicolon:
As we know to print something in C we use printf and ends it with semi-colon but we can print something without using semicolon.
With Semicolon we print something like this:
#include<stdio.h>
void main()
{
printf("Welcome to findnerd");
getch();
}
But without using semi-colon we can print something like this:
#include<stdio.h>
void main(){
/*here if something is written inside printf condition is true and it will print it on console*/
if(printf("Hello"))
{
}
}
We can also use switch case to print something without using semi-colon:
#include<stdio.h>
void main(){
switch(printf("Hello")){
}
}
while loop can be used to print something without using semi-colon, but it will print Hello infinite times:
#include<stdio.h>
void main()
{
while(printf("Hello"))
{
}
}
0 Comment(s)