0

In my HR interview, i had one question. But , i did not answer for this. Can any one give me answer for this? How to display the statement without using semicolon in c programming? i mean, you should use semicolon anywhere in the program.

jillcatrina

<snip fake signature>

3
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by ArkM
0

>How to display the statement without using semicolon in c programming?
I can think of several specific questions based on this vague summary, and each has a different answer. Be more detailed, please.

However, the most likely answer is to run away as fast as you can because question like that suggest your employer is far too clueless for the job to be a good one.

0

In old C we can use undeclared functions. So

main() {
    if (printf("Hello world\n")){}
}

is absolutely well-formed program w/o semicolons. It prints...

Apropos, that's the solution of another silly problem mentioned on this (or C++) forum some weeks ago - how to print numbers from 1 to 100 w/o loops:

void f(int x,int n) 
{
    if (printf("%d\n",x),x<n)
        if (f(x+1,n),1){}
}

int main()
{
    if (f(1,100),1){}
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.