Part 1 : Printf Hello word in C without using semicolon [only ones ]
#include<stdio.h> void main() { if(printf("Hello")) { } }
Output :
Hello
Part 2 : Printf Hello word in C without using semicolon [infinite times]
#include<stdio.h> void main() { while(printf("Hello")) { } }
Part 3 : Printf Hello [Using Switch]
#include<stdio.h> void main() { switch(printf("Hello")) { } }
Part 4 : Using Else-if Ladder
#include<stdio.h> void main() { if(printf("")) { } else if (printf("Hello")) { } else { } }
Part 5 : Printf Hello [Using While and Not]
#include<stdio.h> void main() { while(!printf("Hello")) { } }
Part 6 : Using #define
#include<stdio.h> #define PRINT printf("Hello") void main() { if(PRINT) { } }
Hi,
That was amazing. You not only omitted the semicolon while printing the string but you entirely avoided semicolon in the whole program. An in-depth understanding in C is necessary for System Programming. There are so many interesting things regarding syntax. I expect more such tricks will be published on this blog in near future. Please visit http://technolocus.blogspot.com/2010/06/issues-on-initialization-of-array.html where some advanced issues regarding initialization of arrays have been discussed. Thanks so much for your effort. Many students will find this not only informative but also amusing.
God bless you
it was very interesting …
how to learn more pgms like this
@lohi
You can Explore More such programs here - https://www.c4learn.com/2010/07/c-programming-how-to-new-section.html