+ 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.

14th Mar 2017, 7:28 AM
Tarun kumar parashar
Tarun kumar parashar - avatar
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); }
14th Mar 2017, 11:12 AM
देवेंद्र महाजन (Devender)
देवेंद्र महाजन (Devender) - avatar