how come an additional number is printed: the size 3? see my code below | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

how come an additional number is printed: the size 3? see my code below

int printarray(int arr[], int size) { for(int x=0; x<size; x++) { cout <<arr[x]<< endl; } } int main () { int myarr[]={53, 99, 505}; cout <<printarray(myarr, 3);/*output: 53 99 505 3 */ }

21st Feb 2017, 9:55 PM
Mich
Mich - avatar
1 Answer
+ 1
printarray() has a 'cout ...' line and you have another 'cout ...' in main(), that could be the reason
21st Feb 2017, 11:25 PM
मानस