Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- int main()
- {
- char str1[10]={0};
- printf("Address:\n\n");
- printf("str1: %p\n", (void*) str1);
- printf("&str1: %p\n", (void*) &str1);
- printf("&str1[0]: %p\n", (void*) &str1[0]);
- printf("&str1[1]: %p\n", (void*) &str1[1]);
- printf("\nsizeof:\n\n");
- printf("str1: %zu\n", sizeof str1);
- printf("&str1: %zu\n", sizeof &str1);
- printf("&str1[0]: %zu\n", sizeof &str1[0]);
- printf("&str1[1]: %zu\n", sizeof &str1[1]);
- printf("*str1: %zu\n", sizeof *str1);
- printf("str1[0]: %zu\n", sizeof str1[0]);
- return 0;
- }
- /*
- output:
- Address:
- str1: 0x7fff497215be
- &str1: 0x7fff497215be
- &str1[0]: 0x7fff497215be
- &str1[1]: 0x7fff497215bf
- sizeof:
- str1: 10
- &str1: 8
- &str1[0]: 8
- &str1[1]: 8
- *str1: 1
- str1[0]: 1
- */
Advertisement
Add Comment
Please, Sign In to add comment