Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- /*
- * $ gcc -Wall size.c -o size.o
- * $ nm -S size.o |grep -w D
- * 0000000000000000 0000000000000007 D s1
- * 0000000000000007 0000000000000006 D s2
- * 000000000000000d 0000000000000006 D s3
- * $ ./size
- * s1 7
- * s2 6
- * s3 6
- */
- char s1[] = "123456";
- char s2[6] = "123456";
- char s3[] = {'1', '2', '3', '4', '5', '6'};
- int main(int argc, char *argv[])
- {
- printf("s1 %lu\n", sizeof(s1));
- printf("s2 %lu\n", sizeof(s2));
- printf("s3 %lu\n", sizeof(s3));
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement