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

Assume that the int variables i and j have been declared, and that n has been declared and initialized. Write code that causes a "triangle" of asterisks of size n to be output to the screen. Specifically, n lines should be printed out, the first consisting of a single asterisk, the second consisting of two asterisks, the third consistings of three, etc. The last line should consist of n asterisks. Thus, for example, if n has value 3, the output of your code should be * ** *** You should not output any space characters. Hint: Use a for loop nested inside another for loop.

2 Answers   HCL,


wap for bubble sort

3 Answers  


how to convert decimal to hexadecimal without using arrays just loops

2 Answers  


How to create a program that lists countries capitals when country is entered? (Terribly sorry, I'm a complete novist to coding with C, am looking for inspiration and general tips on how to code and create this program.)

0 Answers  


what is run time error?

7 Answers  






printy(a=3,a=2)

3 Answers  


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

1 Answers  


which typw of errors ? & how to solve it ?

0 Answers  


#include<stdio.h> void main() { int i=1; printf("%d%d%d",i++,++i,i); }

19 Answers  


#include"stdio.h" #include"conio.h" void main() { int a; printf("\n enter a number:"); scanf("%c\n"); getch(); }

12 Answers   HCL,


Write down the difference between c. Loop and goto statement d. (!0) and (!1) e. (1= =! 1) and (1!=1) f. NULL and !NULL

0 Answers  


What are the different types of errors in C and when they occur?

4 Answers  


Categories