Originally posted by Vidya SIngh:
I did not understood how above program is working. As how syntax of
getArray()[index=2]++; is correct. As per me getArray() is a static function that is returning an int array.
This (I think) defines a function returning an array of ints, and is written wrong because it returns null - I expect this to get some compiler information, from which you may be able to make some forward progress. There are fundamental errors in you code that suggest shorter programs to start off with.
The program begins with:
and continues with:
getArray();// would have to have the operator " = " on the left hand side of the words " getArray " The [index = 2] assigns two to the variable index, which would have to access an array:
Your code does not say how many items you want in the array, so I chose 32 becuase it is someplace to start.
As an accident of historical origins which will not likely get a lot of fixes in the immediate time, all array's first element are always indexed at zero. Thus:
The following code will neither work nor compile.
[ May 06, 2007: Message edited by: Nicholas Jordan ]
[ May 06, 2007: Message edited by: Nicholas Jordan ]