pointer

Write your question here.

Use these pointers to store the values 10,20,30,40,50,60,70,80,90,100
List out the addresses of the values in a table.

index address value

Remember to use New, & *
Try this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include<iostream>
using namespace std;
int main()
{
int *a;
a=new int[10];
*a=10;cout<<*a<<", "<<&a<<endl;
for (int x=0;x<9;x++)
{
  a++;
  *a=*(a-1)+10;
  cout<<*a<<", "<<&a<<endl;
}
delete []a;
return 0;
}
What's the point of doing their homework for them? They didn't even ask a QUESTION. They also probably have not read the forum post that says read BEFORE posting and clearly are too lazy to even care about removing the "Write your QUESTION here."

http://cplusplus.com/forum/beginner/1/
http://cplusplus.com/forum/beginner/1/
http://cplusplus.com/forum/beginner/1/
http://cplusplus.com/forum/beginner/1/
Last edited on
Topic archived. No new replies allowed.