Q:

Predict the output of following C++ program

0
//Problems for pointers in c++

#include
using namespace std;

const int s=6;

int main(){

int *p1;int *p2;

int sum[s];

int arr1[]={5,3,4,2,8,10};

int arr2[]={6,8,3,7,5,2};

p1=arr1;

p2=arr2;

for(int k=0;k<s; k++){

sum[k]=*p1+++*p2++;

cout<<sum[k]<< " ";

}

}

All Answers

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

Output:

11   11  7  9  13  12

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