Home » C Programming » Pointers » Question
  1. What will be the output of the following C code?
     #include <stdio.h>
    int main()
    {
    int num = 12;
    int *ptr = #
    foo(&ptr);
    printf("%d ", *ptr);
    printf("%d ", *ptr);
    }
    void foo(int **const ptr)
    {
    int k = 13;
    *ptr = &k;
    printf("%d ", **ptr);
    }
    1. Undefined-value
    2. 13 13 13
    3. Compilation Error
    4. Segmentation fault/code-crash
    5. None of these
Correct Option: B

13 13 13



Your comments will be displayed only after manual approval.