printf statement in C without ";" ?

Today one of my friend just triggered a challenge by asking “Can you print “welcome world” in a C program without applying “;” ?

Hmm.. good question .. Can below do this ?

# include stdio.h

int main ()
{

if (printf (“Welcome world”))
{
printf (“\n.. Yes did it\n”);
}
}

Let me compile and run it ..

[root@test]# gcc fun.c -o fun

[root@test]# ./fun
Welcome world
.. Yes did it

Now , “C” programming GURUs will be thinking “it is very very basic ..”

Is it ? I dont care.. 🙂

1 thought on “printf statement in C without ";" ?”

Comments are closed.