Q:

Predict the output of following C++ program

0
//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;}

}

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Output:

5

5

5

5

5

5

 

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now