[chbot] !!!!!!!! Choc fish challenge 2 !!!!!!!!!
Andre Renaud
andre at bluewatersys.com
Mon Aug 1 03:57:59 BST 2011
Hi Charles,
On 01/08/11 14:13, Charles Manning wrote:
> Under what conditions does the following compile and what will happen when it
> executes?
>
> while(x[j] == j[x]){
> j++; x++;
> }
As far as I can tell, one of x or j has to be an ordinal/integer type.
The other has to be some kind of array type. Since array indexing
essentially becomes addition, x[j] is equivalent to j[x]. I think this
means that it'll run forever.
However, I'm not entirely convinced that typing of x[j] vs j[x] doesn't
come into it, especially if the one of them that is an array has
sizeof() > 1.
Regards,
Andre
More information about the Chchrobotics
mailing list