loop1:
{
x=i<n?(i++):0;
printf("%d",i);
exit(x);
continue;
}
Error- misplaced continue.
Doubt-1.will the exit(x) be executed for all values of x
2.will this statement go out of the program.


Answers were Sorted based on User's Feedback



loop1: { x=i<n?(i++):0; printf("%d",i); exit(x); continue; } Error- misplace..

Answer / vignesh1988i

1) THE exit() function will be occuring only for one value for x in this case.


the main use of exit() function is , whenever we come accross a situation that no other go when we reach certain values we must be back to the IDE again.. so for that purpose we can use exit() function...... here lies an ambiquity since u have given the exit fuction inside the looping structure.. but exit() function when it is called once it will return to the programming screen... but the loop didnt terminate yet...

2) ya sure whenever exit function is encountered this will make to come from prompt mode to the IDE mode



thank u

Is This Answer Correct ?    3 Yes 0 No

loop1: { x=i<n?(i++):0; printf("%d",i); exit(x); continue; } Error- misplace..

Answer / srinivas

Error- misplaced continue.

Is This Answer Correct ?    3 Yes 2 No

loop1: { x=i<n?(i++):0; printf("%d",i); exit(x); continue; } Error- misplace..

Answer / kar4you

Error: Misplaced Continue

Is This Answer Correct ?    1 Yes 0 No

loop1: { x=i<n?(i++):0; printf("%d",i); exit(x); continue; } Error- misplace..

Answer / vija

Dear SRIVIDYA!!!!

as per my experience....
exit() function can take only two arguments. 0(zero) and 1

exit(0)--indicates exit with error
exit(1)--indicates successful exit...

coming to yr code fragment in question..there is a
possibility for exit(x) to take other values..

so this caused the errorrrrr

-------------------------

correct me if its wrong!!


yours vijayabhaskar83@sifymail.com

Is This Answer Correct ?    0 Yes 2 No

loop1: { x=i<n?(i++):0; printf("%d",i); exit(x); continue; } Error- misplace..

Answer / padmaraj

HI,

1: the statement x=i<n?(i++):0;
the value of i is < n the i will be increamented
by 1, else 0.
2 : The value of i is printed.
3 : exit() function is executed by all values of x.
4 : this program will not go out of loop.

Is This Answer Correct ?    0 Yes 3 No

Post New Answer

More C C++ Errors Interview Questions

who was the present cheif governor of reserve bank of india

6 Answers   State Bank Of India SBI,


what is exceptions?

5 Answers   HCL, Wipro,


Write a c-programe that input one number of four digits and find digits sum?

2 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,


Find the error (2.5*2=5) (a) X=y=z=0.5,2.0-5.75 (b) s=15;

3 Answers  






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

6 Answers   HCL,


what is run time error?

7 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,


Given that two int variables, total and amount , have been declared, write a sequence of statements that: initializes total to 0 reads three values into amount , one at a time. After each value is read in to amount , it is added to the value in total (that is, total is incremented by the value in amount ). Instructor's notes: If you use a loop, it must be a for loop. And if you use a loop control variable for counting, you must declare it.

1 Answers   Google,


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  


How to convert hexadecimal to binary using c language..

1 Answers   Bajaj, GAIL, Satyam, Zenqa,


To generate the series 1+3+5+7+... using C program

18 Answers  


Categories