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

A collection of functions,calls,subroutines or other data a) library b) header files c) set of files d) textfiles

651


Is javascript based on c?

596


What are the advantages of using new operator as compared to the function malloc ()?

760


What does void main return?

611


Which of these functions is safer to use : fgets(), gets()? Why?

637






What is keyword with example?

646


What is an auto keyword in c?

645


a linearly ordered set of data elements that have the same structure and whose order is preserved in storage by using sequential allocation a) circular b) ordinary c) array d) linear list

638


How many main () function we can have in a project?

616


When should a far pointer be used?

607


How can I read/write structures from/to data files?

554


What is the purpose of the preprocessor directive error?

686


What is a structure and why it is used?

623


What is .obj file in c?

650


Is printf a keyword?

762