//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;
}
Output:
0
2
4
6
8
10
need an explanation for this answer? contact us directly to get an explanation for this answer