K Khang Lê New member Sep 18, 2021 #1 What will be the output of the following C++ code? Code: #include <iostream> using namespace std; int main() { int *p; void *vp; if (vp == p); cout << "equal"; return 0; } A. equal B. no output C. compile error D. runtime error
What will be the output of the following C++ code? Code: #include <iostream> using namespace std; int main() { int *p; void *vp; if (vp == p); cout << "equal"; return 0; } A. equal B. no output C. compile error D. runtime error
Đ Đức Linh New member Sep 18, 2021 #2 Answer: a Explanation: The void pointer is easily converted to any other type of pointer, so these are equal. Output: Code: $ g++ poi4.cpp $ a.out equal Upvote 0 Downvote
Answer: a Explanation: The void pointer is easily converted to any other type of pointer, so these are equal. Output: Code: $ g++ poi4.cpp $ a.out equal