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 are the two types of functions in c?

572


What is your stream meaning?

610


What is the difference between array_name and &array_name?

782


What is the general form of a C program?

601


What is binary tree in c?

626






C program to find all possible outcomes of a dice?

1858


a program that can input number of records and can view it again the record

1488


What are the various types of control structures in programming?

631


Sir,please help me out with the code of this question. Write an interactive C program that will encode or decode multiple lines of text. Store the encoded text within a data file, so that it can be retrieved and decoded at any time. The program should include the following features: (a) Enter text from the keyboard, encode the text and store the encoded text in a data file. (b) Retrieve the encoded text and display it in its encoded form. (c) Retrieve the encoded text, decode it and then display the decoded text. (d) End the computation. Test the program using several lines of text of your choice.

1770


What is void pointers in c?

595


The % symbol has a special use in a printf statement. Explain how would you place this character as part of the output on the screen?

669


c language supports bitwise operations, why a) 'c' language is system oriented b) 'c' language is problem oriented c) 'c' language is middle level language d) all the above

619


Is there any algorithm to search a string in link list in the minimum time?(please do not suggest the usual method of traversing the link list)

1867


How can you increase the size of a dynamically allocated array?

647


in programming languages a statement or part of a statement that specifies several different execution sequences a) constructs b) distructs c) executes d) none

608