ProgrammingEasyAccenture · Cognizant pattern
Which declaration makes p a pointer to an int?
- A. *int p;
- B. int p*;
- C. int &p;
- 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
- A line such as #include <stdio.h> is processed by:
- Which printf format specifier is meant for printing a pointer value (an address)?
- What is printed? c printf("%d", 10 / 3 3);
- What is printed? c int a = 5, b; b = a++ + 10; printf("%d %d", a, b);
- What is printed? c char s[] = "placement"; printf("%zu %zu", sizeof(s), strlen(s));
- What is printed? c int arr[] = {10, 20, 30, 40}; int p = arr; p += 2; printf("%d", p);