ProgrammingEasyAccenture · Cognizant pattern

Which declaration makes p a pointer to an int?

  1. A. *int p;
  2. B. int p*;
  3. C. int &p;
  4. D. int *p;

Correct answer: D. int *p;

The * in a declaration goes before the name: int *p; declares p as a pointer to int. int &p is a C++ reference, not valid C.

More C Programming questions

Exams that ask this topic