CJCoding With Joseph
15free / daySign inCreate account
Back to Code Walkthrough

Squaring Array Elements

C++ code walkthrough · Question 39
easyArrays

Code

Read carefully. What does this print?
1#include <iostream>
2using namespace std;
3int main() {
4 int arr[4] = {1, 2, 3, 4};
5 for (int i = 0; i < 4; i++) {
6 arr[i] *= arr[i];
7 }
8 cout << arr[0] << " " << arr[3] << endl;
9 return 0;
10}

Your answer