Multiple choice technology programming languages

main() { char *p; int *q; long *r; p=q=r=0; p++; q++; r++; printf("%p\t%p\t%p",p,q,r); }

  1. 0001 0002 0003

  2. compile error

  3. 0001 0002 0004

  4. 0001 0002 0006

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

Pointer arithmetic advances by the size of the pointed-to type. char* increments by 1 byte, int* by sizeof(int) (2 bytes on typical 16-bit systems), and long* by sizeof(long) (4 bytes on typical 32-bit systems). Starting from 0, the pointers become 1, 2, and 4 respectively.