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
How many levels of pointers can you have?
What is return type in c?
What is static identifier?
find the output? void r(int a[],int c, int n) { if(c>n) { a[c]=a[c]+c; r(a,++c,n); r(a,++c,n); } } int main() { int i,a[5]={0}; r(a,0,5); for(i=0;i<5;i++) printf("\n %d",a[i]); getch(); }
Program to find the sum of digits of a given number until the sum becomes a single digit. (e.g. 12345=>1+2+3+4+5=15=>1+5=6)
Is it possible to use curly brackets ({}) to enclose single line code in c program?
What is static memory allocation? Explain
Is c is a middle level language?
When should the register modifier be used? Does it really help?
Do you know the difference between exit() and _exit() function in c?
There seem to be a few missing operators ..
Do you know the purpose of 'register' keyword?
What is the explanation for cyclic nature of data types in c?
What is a macro?
What is 1f in c?