Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //-std=c99 -Wall -Wextra -Wpedantic -Wshadow
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- char arr[10] = {'a','b','c','d','e','f','g','h','i','j'};
- char *p = &arr[10];
- printf("%c\n",p[-1]);
- printf("%c\n",(-1)[p]);
- printf("%c\n",(-1)[&arr[10]]);
- printf("%c\n",(-1)[arr+10]);
- printf("%c\n",*(&2[arr]));
- printf("%c\n",*(arr+2));
- printf("%c\n",2[arr]);
- printf("%c\n",arr[2]);
- return 0;
- }
- /*
- output:
- j
- j
- j
- j
- c
- c
- c
- c
- */
Advertisement
Add Comment
Please, Sign In to add comment