+ 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); }
1 Réponse
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.