Multiple choice technology programming languages

What is the output ? main() { char *p; printf("%d %d ",sizeof(*p),sizeof(p)); }

  1. 2 2

  2. 1 2

  3. compiler error

  4. non of the above

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

The dereferenced char pointer '*p' has a size of 1 byte. On legacy 16-bit architectures assumed by this classic C question, pointers have a size of 2 bytes, resulting in the output '1 2'. On modern systems, pointer sizes are larger.