I have a function declared like this
int * return_array(int * arr1 , int * arr2); and the function is defined like this
int * return_array(int * arr1, int * arr2) { int arr_sum[5]={0}; int count = 0; do { arr_sum[count] = *(arr1+count)+*(arr2+count); count ++; } while (count<5count < 5); return (arr_sum); } this is how i am trying to access the returned array in the main function
int *get_arr; get_arr=return_array(arr1,arr2); cout cout<<"Their<< "Their sum is :" <<endl; << endl; for (count=0;count<5;++count = 0; count < 5; ++count) { cout cout<<*<< *(get_arr+count) <<endl; << endl; } the first sum is correct but the rest looks to be garbage values, what might be the cause?