Home » C Programming » Pointers » Question
  1. What will be the output of the following C code?
    #include <stdio.h>
    int main()
    {
    void *ptr1;
    int var[5] = {50, 60, 70, 80, 90};
    ptr1 = &var[3];
    int *ptr2 = &var[4];
    int m = (int*)ptr1 - ptr2;
    printf("%d\n", m);
    }
    1. 90
    2. Compilation Error
    3. Garbage value
    4. -1
    5. None of these
Correct Option: D

-1



Your comments will be displayed only after manual approval.