What is the output of the following C++ code?
#include
using namespace std;
void sum(int x, int y, int & z) { z = x + y; }
int main()
{
int list1[3], list2[3];
int a = 5, b = 10, c = 0;
for (int i = 0; i < 3; i++)
{
list1[i] = i + 1;
list2[i] = i + 2;
}
//a sum(a, b, c);
cout << "c = " << c << endl;
//b sum(list1[0], list2[0], c);
cout << "c = " << c << endl;
//c sum(list1, list2, c);
cout << "c = " << c << endl;
//d for (int i = 1; i < 3; i++)
{
sum(list1[i], list2[i], c);
cout << "c = " << c << endl;
}
return 0;
}