//Problems for pointers in c++
#include
using namespace std;
const int s=6;
int *arr_doub(int arr[],int a[]){
int *p=new int[s];
for(int i=0;i<s; i++)
p[i]=arr[i]+a[i]; return p;
}
int main(){
int *p1;
int a1[]={0,1,2,3,4,5};
int a2[]={5,4,3,2,1,0};
p1=arr_doub(a1,a2);
for(int i=0;i<6;i++){
cout<<*(p1+i)<<" ";
cout<<endl;}
}
Output:
5
5
5
5
5
5
need an explanation for this answer? contact us directly to get an explanation for this answer