+ 1
Use dynamic array in fuction parameter
wanna make a function that accepts a dynamic array. like int something (int sizeofarray, int array []) like that.
1 Odpowiedź
0
/************************************
Passing array in a function using pointer
*************************************/
#include <iostream>
using namespace std;
void transverse(int *ptr){
//continues till there are values in the array.
while (*ptr){
cout<<*ptr<<endl;
ptr++;
}
}
int main (void){
int a[]={10,20,120,2400,785,5692};
transverse(a);
}