Examveda
Examveda

Consider the following code:
void main()
{
   int a[5] = {6,8,3,9,0}, i=0;
   if(i != 0)
   {
      break;
      printf("%d", a[i]);
   }
   else
      printf("%d", a[i++]);
}

What is the output of the above program?

A. 6

B. 8

C. Runtime error

D. Syntax error

E. No output

Answer: Option D

Solution(By Examveda Team)

break can't be used with selection control structures, but can used with repetitive(for, while), or select control structure(switch).


This Question Belongs to C Program >> Control Structures

Join The Discussion

Comments ( 2 )

  1. Examveda
    Examveda :
    8 years ago

    break statement only used within loop or switch to control the cursor.

  2. Ishwar Kumar
    Ishwar Kumar :
    8 years ago

    Doubt in answer of this question . What's differnce between selection control and select control structure

Related Questions on Control Structures