Passing an array into a function | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Passing an array into a function

void func(int x[], int y) { x[0] = 0; y=0; } int main () { int x [] = {7}, y=8; func (x, y); cout << x[0] << y; } // The output is 08 Why is the output not 78? After all, there is not return statement in the void function. Even so, how come only the y value is NOT returned?

31st Jul 2020, 8:41 PM
Solus
Solus - avatar
0 Answers