C++ Arrays Quiz - Question 9

Last Updated :
Discuss
Comments

What will be the output of the following code?

C++
#include <iostream> using namespace std;  void modifyArray(int arr[], int size) {     for(int i = 0; i < size; i++) {         arr[i] += 5;     } }  int main() {     int arr[3] = {1, 2, 3};     modifyArray(arr, 3);     for(int i = 0; i < 3; i++) {         cout << arr[i] << " ";     }     return 0; } 

1 2 3

6 7 8

1 7 3

Compilation error

Share your thoughts in the comments
Article Tags :