Home » C Programming » Pointers » Question
  1. What will be the output of the following C code?
     #include <stdio.h>
    int main()
    {
    int n = 58, *ptr = &n;
    function(&ptr);
    printf("%d ", *ptr);
    return 0;
    }
    void function(int **ptr)
    {
    int k = 12;
    *ptr = &k;
    printf("%d ", **ptr);
    }
    1. Undefined behaviour
    2. 58
    3. Segmentation fault/code crash
    4. 12 12
    5. None of these
Correct Option: D

12 12



Your comments will be displayed only after manual approval.