samiuljahan's blog

there's always room for improvement

Basic Programming Quiz 0010

leave a comment »

Examine the code snippets given below—-

#include <stdio.h> 
int main()
{ 
    char ch;
    while((ch = getchar()) != '\0')
    putchar(ch);
    return 0;
}

What does the program display?

Look at another code snippets—-

#include <stdio.h> 
int main()
{ 
    while( putchar(getchar( )) != '\0' ) ;
    return 0;
}

Now, what does it display?
Is there any difference in program execution between these two code snippets?

Advertisement

Written by সামিউল(samiul)

September 10, 2011 at 11:12 am

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.