void main()
{
char c;
while(c=getchar()!='\n')
printf("%d",c);
}
o/p=11 why?

Answer Posted / prashant

The answer would have been 11 only if the while statement would have had a semicolon to finish with , i.e. "while(c=getchar()!='\n');" According to the above code it will generate the ascii of all the characters entered except the newline character.

Regards
Prashant

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the explanation for modular programming?

678


Explain the properties of union.

605


What are the three constants used in c?

538


What does it mean when the linker says that _end is undefined?

623


Why ca not I do something like this?

583






In c programming, explain how do you insert quote characters (? And ?) Into the output screen?

756


How many types of operators are there in c?

610


When should volatile modifier be used?

544


Stimulate calculator using Switch-case-default statement for two numbers

2439


What does the characters “r” and “w” mean when writing programs that will make use of files?

848


What is the difference between scanf and fscanf?

656


What are the 5 data types?

592


Explain what are global variables and explain how do you declare them?

635


What are the similarities between c and c++?

591


What is null pointer in c?

587