main()
{
char c;
for(c='A';c<='Z';c++)
getch();
}

Answers were Sorted based on User's Feedback



main() { char c; for(c='A';c<='Z';c++) getch(); }..

Answer / ravi

NO ERRORS but result...........

Is This Answer Correct ?    9 Yes 3 No

main() { char c; for(c='A';c<='Z';c++) getch(); }..

Answer / rakesh

in this question whenever the loop excuted getch() take
input after that next loop is excuted and similar getch()
take another input
that think do untill the conditions of c<='z' is not
completed

Is This Answer Correct ?    5 Yes 2 No

main() { char c; for(c='A';c<='Z';c++) getch(); }..

Answer / sujeesh krishnan

The initial condition is c='A'.
Here the the statement "getch();" is the body of the loop.
it is executed once and c becomes 'B' and again the loop is
executed.
This is done,I mean the loop is executed 26 times.
when c become 'Z' the loop is executed one more time(because
the condition is c<='Z')and then the program exit.

Is This Answer Correct ?    3 Yes 1 No

main() { char c; for(c='A';c<='Z';c++) getch(); }..

Answer / vignesh1988i

this wont show any errors since syntactically it is correct...
but since there is no instructions after for loop for operations unfortunelety getch() will be taken as the next instruction , and thus compiler system will be under ambiquity. since the character key pressed will be taken as the value of getch() so that will say to the OPERATING SYSTEM that compilation has got over and it will return to the IDE... but for loop has not got over.. so this depends on the compilers usage............



thank u

Is This Answer Correct ?    1 Yes 0 No

main() { char c; for(c='A';c<='Z';c++) getch(); }..

Answer / aaaaaaa

No Errors
loop will execute for 26 times,each time it will wait for an
input and finally terminate when c becomes > Z.

Is This Answer Correct ?    1 Yes 0 No

main() { char c; for(c='A';c<='Z';c++) getch(); }..

Answer / sambath

Answer : "It have no errors but it will be still running
mode until use cntrl+break.. using { and } we will avoid this."

Is This Answer Correct ?    0 Yes 0 No

main() { char c; for(c='A';c<='Z';c++) getch(); }..

Answer / abhishek rajput

Since A=65 and Z=90.
So each time getch will
encounter and user
need to press anykey
each time till c
increments to 90...

Is This Answer Correct ?    0 Yes 0 No

main() { char c; for(c='A';c<='Z';c++) getch(); }..

Answer / carlos

God help those who help themselves!
try it ur's self because i don't know about this programming
brother! i'm sorry forgive me.

Is This Answer Correct ?    2 Yes 3 No

main() { char c; for(c='A';c<='Z';c++) getch(); }..

Answer / bharghavi

if ther s no body for the 'for' loop,it should end with
semicolon..(i.e)
main()
{
char c;
for(c='A';c<='Z';c++);
getch();
}
or
main()
{
char c;
for(c='A';c<='Z';c++)
{}
getch();
}

Is This Answer Correct ?    6 Yes 11 No

Post New Answer

More C C++ Errors Interview Questions

How to reverse a linked list without using array & -1? Thank you.

2 Answers   Access, Satyam,


void main() { int i=7; printf("N= %*d",i,i); }

6 Answers   HCL,


what is exceptions?

5 Answers   HCL, Wipro,


Write a program to accept two strings of Odd lengths. Then take all odd characters from one string and even characters from the other and concatenate and produce a string.

1 Answers  


How to create a program that lists the capital country when told what the original country is? (Terribly sorry, I'm a novice programmer and would appreciate any help ;). Cheers, Alexxis

0 Answers  






write a profram for selection sort whats the error in it?

2 Answers  


main() { char c; for(c='A';c<='Z';c++) getch(); }

9 Answers  


what are the techniques for reducing the fragility of a memory bug?

1 Answers  


WHAT WILL BE THE OUTPUT OF THE FOLLOWING QUESTION void main() { int x=4,y=3,z; z=x-- -y; printf("%d%d%d",x,y,z); }

25 Answers   HCL,


when i use cout or cin call & then either << or >> .....it shows declaration syntax error...what should i do? cout<<"anything"; int a; cin>>a; return 0;

2 Answers  


A sample program using data structure? what is file handling?

0 Answers   TCS,


which typw of errors ? & how to solve it ?

0 Answers  


Categories