Ask Question
8 January, 09:08

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;

}

+5
Answers (1)
  1. 8 January, 13:04
    0
    Your not including anything in your code.

    Explanation:

    According to your text all you have is #include. You didn't incldue any directives so you will get a error.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “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 () { ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers