void main()
{
char c;
while(c=getchar()!='\n')
printf("%d",c);
}
o/p=11 why?
Answer Posted / hari.11
above friend has posted correct answer,
11 is not the correct answer,
it will take all characters into buffer and will not output any answer until we press '\n' character.
So it would print 1 as many times as number of character pressed before '\n'.
e.g.:
s
o/p: 1
sd
o/p: 11
gdfdd
o/p: 11111
111
o/p: 111
for further queries and discussions, visit..
http://forum.campusmaniac.com/
http://www.campusmaniac.com/
| Is This Answer Correct ? | 2 Yes | 1 No |
Post New Answer View All Answers
How to declare a variable?
What does the error message "DGROUP exceeds 64K" mean?
Why is sizeof () an operator and not a function?
Is there a way to compare two structure variables?
Does c have an equivalent to pascals with statement?
What's a good way to check for "close enough" floating-point equality?
What is this pointer in c plus plus?
What is ctrl c called?
Can you explain the four storage classes in C?
What is an endless loop?
What is the purpose of scanf() and printf() functions?
Write a program to swap two numbers without using the third variable?
What should malloc() do? Return a null pointer or a pointer to 0 bytes?
what is the c source code for the below output? 10 10 10 10 10 10 10 10 10 10 9 9 7 6 6 6 6 6 6 9 7 5 9 7 3 2 2 5 9 7 3 1 5 9 7 3 5 9 7 4 4 4 4 5 9 7 8 8 8 8 8 8 8 8 9
Explain what happens if you free a pointer twice?