Another silly question

Paul Castonguay castong at bucsb.UUCP
Wed May 24 11:15:20 AEST 1989


>
>> 	The statement that *(a+i) == *(i+a) is therefore invalid.
>
>No, the statment is true.
>-- 

#include<stdio.h>
main()
{
    int *a;
    int i=1;

    a = (int *)malloc(16);
    *a = 0;
    *(a+1) = 4;
    *(a+2) = 0;
    *(a+3) = 0;

    printf("*(a+i) = %d  ", *(a+i));
    printf("*(i+a) = %d\n", *(i+a));
}


Output produced:

*(a+i) = 4  *(i+a) = 4


Does that not show that *(a+i) == *(i+a) ?



More information about the Comp.lang.c mailing list