+ 1

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
+ 6
Remove 'cout << ' at line cout <<printarray(myarr, 3);
21st Feb 2017, 10:55 PM
Tashi N
Tashi N - avatar