Pick out the correct statement.
What does the dereference operator will return?
What is the output of this program?
1. #include2. using namespace std; 3. int main() 4. { 5. double arr[] = {5.0, 6.0, 7.0, 8.0}; 6. double *p = (arr+2); 7. cout << *p << endl; 8. cout << arr << endl; 9. cout << *(arr+3) << endl; 10. cout << *(arr) << endl; 11. cout << *arr+9 << endl; 12. return 0; 13. }
a) 7
0xbf99fc98
8
5
14
b) 7
8
0xbf99fc98
5
14
c) 0xbf99fc98
d) none of the mentioned
What is the output of this program?
1. #include2. using namespace std; 3. int main() 4. { 5. int x = 9; 6. int* p = &x; 7. cout << sizeof(p); 8. return 0; 9. }
What is the output of this program?
1. #include2. using namespace std; 3. int main () 4. { 5. int a; 6. int * ptr_b; 7. int ** ptr_c; 8. a = 1; 9. ptr_b = &a; 10. ptr_c = &ptr_b; 11. cout << a << "\n"; 12. cout << *ptr_b << "\n"; 13. cout << *ptr_c << "\n"; 14. cout << **ptr_c << "\n"; 15. return 0; 16. }
a) 1
1
0xbffc9924
1
b) 1
1
1
0xbffc9924
c) 1
0xbffc9924
1
1
d) none of the mentioned