H Hằng Đoàn New member Sep 18, 2021 #1 What will be the output of the following C++ code? Code: #include <iostream> using namespace std; void square (int *x) { *x = (*x + 1) * (*x); } int main ( ) { int num = 10; square(&num); cout << num; return 0; } A. 100 B. compile time error C. 144 D. 110
What will be the output of the following C++ code? Code: #include <iostream> using namespace std; void square (int *x) { *x = (*x + 1) * (*x); } int main ( ) { int num = 10; square(&num); cout << num; return 0; } A. 100 B. compile time error C. 144 D. 110
P Pham Quỳnh Anh New member Sep 18, 2021 #2 Answer: d Explanation: We have increased the x value in operand as x + 1, so it will return as 110. Output: Code: $ g++ arg2.cpp $ a.out 110 Upvote 0 Downvote
Answer: d Explanation: We have increased the x value in operand as x + 1, so it will return as 110. Output: Code: $ g++ arg2.cpp $ a.out 110