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

Answer Posted / sumeet saini

It says %d which means it prints integer value. If we want to print character we need to write %c. So the answer is right. If we replace %d with %c . This program will print what ever character we hit from keyboard until we press enter

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can I change their mode to binary?

687


Can a program have two main functions?

565


What is variable in c example?

590


What is file in c preprocessor?

646


What are header files? What are their uses?

630






What is a macro, and explain how do you use it?

621


PLS U SENS ME INTERVIEW O. MY EMAIL ADD, SOFIYA.SINGH@GMAIL.COM

1699


How many identifiers are there in c?

571


Is it better to use malloc() or calloc()?

641


Why c is called procedure oriented language?

573


Explain what standard functions are available to manipulate strings?

605


What is wrong in this statement? scanf(ā€œ%dā€,whatnumber);

718


Is javascript written in c?

571


What is the symbol indicated the c-preprocessor?

688


where are auto variables stored? What are the characteristics of an auto variable?

582