+ 1

Can we pass direct values in the function without using myarr[] if yes then how ?

void printArray(int arr[], int size) { for(int x=0; x<size; x++) { cout <<arr[x]<< endl; } } int main() { int myArr[3]= {42, 33, 88}; printArray(myArr, 3); }

16th Mar 2017, 5:34 AM
Saiyyed aman ali
Saiyyed aman ali - avatar
1 Resposta
0
You could just declare a lot of arguments type int or something for the function, but often that's just waste of time and you are more likely to get lost with all the variables.
20th Mar 2017, 1:56 AM
Jan Kliszcz
Jan Kliszcz - avatar