T Tam ca New member Sep 18, 2021 #1 What will be the output of the following C++ code? Code: #include <stdio.h> #include <iostream> using namespace std; int main() { int array[] = {10, 20, 30}; cout << -2[array]; return 0; } A. -15 B. -30 C. compile time error D. garbage value
What will be the output of the following C++ code? Code: #include <stdio.h> #include <iostream> using namespace std; int main() { int array[] = {10, 20, 30}; cout << -2[array]; return 0; } A. -15 B. -30 C. compile time error D. garbage value
N Nguyễn Tuyền New member Sep 18, 2021 #2 Answer: b Explanation: It's just printing the negative value of the concern element. Code: $ g++ array.cpp $ a.out -30 Upvote 0 Downvote
Answer: b Explanation: It's just printing the negative value of the concern element. Code: $ g++ array.cpp $ a.out -30