Can anyone please help me understand the following code:
int d = 4;
printf(&d["Hay!Hello %c\n"], &4["BuddyWorld"]); // Hello (some address in char)
printf(&d["Hay!Hello %c\n"], 4["BuddyWorld"]); // Hello y
printf(&d["Hay!Hello %s\n"], 4["BuddyWorld"]); // Segmentation fault
printf(&d["Hay!Hello %s\n"], &4["BuddyWorld"]); // Hello yWorld
printf("d[Hay!Hello %s\n"], &4["BuddyWorld"]);
/* warning: passing argument 1 of 'printf' makes pointer
from integer without a cast */
What is exactly the d[] or &d[] operator? (d is an integer)
Why does &4["BuddyWorld"]
and 4[BuddyWorld]
yields to different values? ('W' and 'y' respectively)