CP I/O Q21

0. The following program
main()
{
int i = 2;
{ int i = 4, j = 5;
printf ("%d%d", i, j );
}
printf("%d%d", i, j );
}

  • Option : A
  • Explanation :
    This will not compile successfully. The scope of the variable ' j ' is the single printf statement that follows it.
    So. the last statement that involves ' j ' will complain about the undeclared identifier ' j '
Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *