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>

>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.

The compound statement {}
But "how to display it" ???...

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){}
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.