Home » C Programming » Variables » Question
  1. Comment on the following 2 C Example programs.
    #include <stdio.h> //Example 1
    int main()
    {
    int p;
    int q;
    int r;
    }

    #include <stdio.h> //Example 2
    int main()
    {
    int p;
    {
    int q;
    }
    {
    int r;
    }
    }
    1. Scope of r is till the end of the main function in Example 2
    2. In Example 1, variables p, q and r can be used anywhere in main function whereas in Example 2, variables q and r can be used only inside their respective blocks.
    3. Both are same
    4. Scope of p, q and r is till the end of the main function in Example 2.
    5. None of these
Correct Option: B

None of these



Your comments will be displayed only after manual approval.