Top

Discussion

Point out the error, if any in the program.

#include
int main()
{
    int P = 10;
    switch(P)
    {
       case 10:
       printf("Case 1");

       case 20:
       printf("Case 2");
       break;

       case P:
       printf("Case 2");
       break;
    }
    return 0;
}

 

  • A.Error: No default value is specified
  • B.Error: Constant expression required at line case P:
  • C.Error: There is no break statement in each case.
  • D.No error will be reported.

Answer: B

No answer description available for this question.
 

No comment is present. Be the first to comment.
Loading…

Post your comment