why are the two object equals?
i've ran this code
#include <stdio.h>
#include <string.h>
main()
{
int i = 4;
int arr[10];
printf("%d", arr[i]==i[arr]);
}
and got the output 1, as part of a job interview i had that asked what's
the output. i'm scratching thinking that i understand why it is compiling,
but i was certain it would be a segmentation fault or ate least 0 because
the address of i[arr] isn't known...
where am i gone wrong? is it every address considered 0 until initialized?
No comments:
Post a Comment