[Numpy-discussion] C vs. Fortran order -- misleading documentation?

David Cournapeau cournape@gmail....
Wed Jun 9 11:00:31 CDT 2010


On Thu, Jun 10, 2010 at 12:09 AM, Benjamin Root <ben.root@ou.edu> wrote:
>> I think that arrays are just syntax on pointer is indeed the key
>> reason for how C works here. Since a[b] really means a + b (which is
>> why 5[a] and a[5] are the same), I don't see how to do it differently.
>
> Holy crap!  You can do that in C?!

Yes:

#include <stdio.h>

int main()
{
	float a[2] = {1.0, 2.0};

	printf("%f %f %f\n", a[1], *(a+1), 1[a]);
}


More information about the NumPy-Discussion mailing list