Vote count:
0
#include "stdafx.h"
#include <iostream>
using namespace std;
void silly(int & a, int & b)
{
a=10;
b=20;
cout << a << "" << b << endl;
}
void main()
{
int z=30;
silly(z,z);
cout << z << endl;
system("Pause");
}
The output for this is:
2020 20
Why are there 3 outputs, and why does b override a?
I'm asking because this is part of homework and I don't exactly understand the passing of variables especially strings/arrays.
asked 29 secs ago
Aucun commentaire:
Enregistrer un commentaire