Home » C Programming » Pointers » Question
  1. What will be the output of the following C code?
    #include <stdio.h>
    int n = 0;
    void main()
    {
    int *const p = &n;
    printf("%p\n", p);
    p++;
    printf("%p\n ", p);
    }
    1. Same memory address
    2. Compilation Error
    3. Different memory address
    4. Garbage value
    5. None of these
Correct Option: B

main.c: In function ‘main’:
main.c:7:10: error: increment of read-only variable ‘p’
p++;



Your comments will be displayed only after manual approval.