POV-Ray : Newsgroups : povray.off-topic : Reach for the SKI : Re: Reach for the SKI Server Time
6 Oct 2024 06:43:01 EDT (-0400)
  Re: Reach for the SKI  
From: scott
Date: 27 Jul 2015 03:21:11
Message: <55b5dbe7$1@news.povray.org>
>> If L=1 then a[b] == b[a].
>
> Uh, how do you figure? The memory locations of the two variables might
> be in no way related.

"a" is a pointer-to type, "b" is an integer type.

a[b] just means read the memory at location a+b. The "+" operator 
doesn't care which way round the variables are. Also thinking about it, 
this probably works for any array type, as the "+" operator knows how to 
add an integer to a pointer-to type in general (it multiplies the 
integer by the size of each array element first).


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.