Q:

Predict the output of following C++ program

0

 

 

//Problems for pointers in c++

#include

using namespace std;

int *arr_doub(int arr[],int s)

{

for(int i=0;i<s; i++)

arr[i]=arr[i]*2;

int *p=arr; return p;

}

int main()

{

int *p;

int a[]={0,1,2,3,4,5};

p=arr_doub(a,6);

for(int i=0;i<6;i++)

cout<<*(p+i)<<endl;

}

 

All Answers

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

Output:

0

2

4

6

8

10

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