Variables a and b are not initialised. That means they contain garbage, and could have any random value.
Because of that, it is very likely that elements outside the array billy are being accessed. If the value of a is unknown, then a+2 is also unknown.
billy[a+2] means, first evaluate the expression (a+2) and then use the resulting value as the subscript. The same applies to billy[billy[0]+2], first evaluate (billy[0]+2) and then use that as the subscript.
then billy[0] now has the value 3 and a is unchanged, it is still 3.
But be careful with this line: b=billy[a+2];
since a is 3, that is in effect doing b=billy[3+2] or b=billy[5]. But remember billy is an array of just four elements,
billy[0]
billy[1]
billy[2]
billy[3]
and billy[5] is invalid because it is outside the array.
it means b=billy[billy[0]+2];
then b=billy[16+2] >> b=billy[18] ??
but in line 4, it stated billy[a]=75;
then billy[0]=a >> billy[billy[0]=75
which i will get b=billy 75+2??
i dont understand about how these arrays inside arrays works @_@
I think your understanding is roughly correct.
However, unless I'm mistaken, a line such as this: billy[billy[a]] = billy[2] + 5;
is not shown as part of a complete program, is it? I think it was shown only as an example of what the syntax looks like. But you should not try to run that code except for the complete program examples.
If you wanted to experiment with code such as that, you should first make sure that your array contains enough elements, and where necessary the values are suitable in order to avoid going out of bounds. This is an important thing to know about arrays in C++, the compiler will let you write code which may access elements outside the array. It doesn't check. It is your responsibility as a programmer to ensure that you stay within the array boundaries.
And also, it isn't really correct to describe this as an array inside an array. That would be something very different. What we have here is merely an array element being used to calculate an array subscript.
Your problem doesn't seem to be understanding arrays, it's understanding assignments. billy[0]=a is not the same as a=billy[0]. When you make an assignment, the term on the left is set to be equal to the term on the right. As for the array subscripts, you evaluate the stuff inside the square brackets first.
1 2 3 4 5 6 7
*from cplusplus.com tutorials*
billy[5]={16, 2, 77, 40, 12071 };
billy[0] = a; // a is uninitialized so this doesn't make any sense. Let's assume a=billy[0]
billy[a] = 75; // going from above, you would be trying to call billy[16] which doesn't exist.
b = billy [a+2]; // this would be equivalent to b=billy[18]
billy[billy[a]] = billy[2] + 5; //billy[billy[a]] evaluates billy[a] (call it c for arguments sake) first
// and then assigns billy[c] to billy[2]+5
Here's an example that works:
1 2 3 4 5 6 7 8 9
// include headers
int a=1;
int billy[5]={0,1,2,3,4};
billy[0]=a; // array is now {1,1,2,3,4}
billy[a]=2; // array is now {1,2,2,3,4}
billy[billy[a]]=billy[3]+2; // array is now {1,2,5,3,4}
int b=billy[billy[billy[0]]]; //billy[billy[billy[0]]] is the same as billy[billy[1]]
//which is the same as billy[2] which is 5.
std::cout << b; //prints 5.