What we can't do on a void pointer?
What is the output of this program?
1. #include2. using namespace std; 3. int main() 4. { 5. int a = 5, c; 6. void *p = &a; 7. double b = 3.14; 8. p = &b; 9. c = a + b; 10. cout << c << '\n' << p; 11. return 0; 12. }
What is the output of this program?
1. #include2. using namespace std; 3. int main() 4. { 5. int n = 5; 6. void *p = &n; 7. int *pi = static_cast (p); 8. cout << *pi << endl; 9. return 0; 10. }
What is the output of this program?
1. #include2. using namespace std; 3. int main() 4. { 5. int i; 6. char c; 7. void *data; 8. i = 2; 9. c = 'd'; 10. data = &i; 11. cout << "the data points to the integer value" << data; 12. data = &c; 13. cout << "the data now points to the character" << data; 14. return 0; 15. }
What is the output of this program?
1. #include2. using namespace std; 3. int main() 4. { 5. int *p; 6. void *vp; 7. if (vp == p); 8. cout << "equal"; 9. return 0; 10. }