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,


How to convert hexadecimal to binary using c language..

1 Answers   Bajaj, GAIL, Satyam, Zenqa,


Given that two int variables, total and amount, have been declared, write a loop that reads integers into amount and adds all the non-negative values into total. The loop terminates when a value less than 0 is read into amount. Don't forget to initialize total to 0. Instructor's notes: This problem requires either a while or a do-while loop.

3 Answers  


errors are known as?

3 Answers   EX, State Bank Of India SBI,


Declaration of Cube Guys please help me.. Is this a right way to declare cube.? If i Compile it. It Says: Cube undeclared what should i do? Please help \thanks in advanced #include<stdio.h> #include<math.h> #include<conio.h> main( ) { float x,y; while(x++<10.0) { printf("Enter Number:"); scanf("%d", &x); y = cube(x); printf("%f %f %f \n", x,pow(x,2),y); cube(x); } { float x; float y; y = x*x*x; } getch(); return (y); }

2 Answers  






UINT i,j; i = j = 0; i = ( i++ > ++j ) ? i++ : i--; explain pls....

5 Answers  


how to convert decimal to binary in c using while loop without using array

50 Answers   Apple, Aptech, Arwen Tech, BCS, C2D Software, CEC,


what is meant for variable not found?

3 Answers  


I'm having trouble with coming up with the correct code. Do I need to put a loop? Please let me know if I'm on the right track and what areas I need to correct. I still don't have a good grasp on this programming stuff. Thanks =) The assignment was to write a program using string functions that accepts a coded value of an item and displays its equivalent tag price. The base of the keys: 0 1 2 3 4 5 6 7 8 9 X C O M P U T E R S Sample I/O Dialogue: Enter coded value: TR.XX Tag Price : 68.00

3 Answers   UCB,


class test { int a; public: test(int b):a(b){} void show(){ cout<<a; } }; void main() { test t1; test t2(5); t1.show(); t2.show(); } }

1 Answers  


I can not get my C++ program to work right. It is supposed to tell if a word is a palindrome or not, but it only tells thet the word is not a palindrome. And I can't fix it.

1 Answers  


Display this kind of output on screen. 1 0 1 1 0 1 3. Display this kind of output on screen. 1 1 0 1 0 1 4. Display this kind of output on screen. 1 1 0 1 0 1 5.Display this kind of output on screen. 1 2 3 4 5 6 7 8 9 10

1 Answers  


Categories