My idiotic sence of Array's with Operators and Referent's

So far I understand that the basic purpose of an array's is to save a sequence of integer's/string/ data value's in one single "space"
so im guessing that this mean's that i can manipulate the array in many way's but if so then what are it's limit.
i believe that what im trying to ask is, if i can store data within an array does that mean that I can use pointer's(*) and also reference's(&) as manipulation, and if so then how come this code i stumble upon to make does not work in any way.

code:
#include <iostream>
#include <cmath>
using namespace std;

int main()
{
int a1,a2,a3;

int *a[3] = {&a1,&a2,&a3} ;

cin >> a1 >> a2 >> a3 ;

cout << *a[3] ;


system("PAUSE");
return 0;
}

by the way any kind of knowledge that might be usefull to understand arrays is appriciated if shared
Last edited on
The line below is the cause. offset's range used with array in C/C++ is from 0 to arraySize-1.

cout << *a[3] ;
oh i get it so basically the deferenciatioin(*) pointer can only get one value at a time? or am i way off?
because after thinking about what you said i desided to try spliting my array's into individal cout's

cout << *a[0] << *a[1] << *a[2] ;

or am i wrong and theres another reason the code work's properly now?
Last edited on
Exactly what you understood is correct!
Topic archived. No new replies allowed.