Consider the code snippet below.
int ch = 100;
Which of the following is a legally correct way of obtaining the memory location of ch and printing it (the memory location) to standard output, based on the given code snippet?
A) cout << ch << endl;
B) cout << *ch << endl;
C) cout << &ch << endl;
D) cout << *(&ch) << endl;
Ans: C
Title: Which statement gets the memory location of ch and prints it to standard output?
Difficulty: Easy
Pointers
- Which of the following is a legally correct way of declaring a variable that is a pointer to an integer?
- What is true about the statement given below? int* choice;
- Which of the following statements is true about pointers?
- A pointer describes which of the following?
- Which statement is true about an uninitialized pointer?