Home » C Programming » Pointers » Question
  1. What will be the output of the following C code?
    #include <stdio.h>
    int main()
    {
    int n = 12;
    int *const ptr = &n;
    function(&ptr);
    printf("%d\n", *ptr);
    }
    void function(int **ptr)
    {
    int k = 15;
    *ptr = &k;
    printf("%d\n", **ptr);
    }
    1. 12
    2. Compilation Error
    3. 15
      15
    4. Garbage value
    5. None of these
Correct Option: C

15
15



Your comments will be displayed only after manual approval.