C++ Quiz Questions Set 2

1) What is the out put?
void main()
 int a, *pa, &ra;
 pa = &a;
 ra = a;
 cout << "a=" << a << "*pa=" << *pa << "ra=" << ra;
Compiler Error: 'ra',reference must be initialized

Pointers are different from references. One of the main differences is that the pointers can be both initialized and assigned, whereas references can only be initialized. So this code issues an error.

No comments:

Post a Comment