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 Resposta
+ 1
printarray() has a 'cout ...' line and you have another 'cout ...' in main(), that could be the reason
21st Feb 2017, 11:25 PM
मानस