Advertisement
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 *s = "This is a string in memory pointed to by s, look at me. I'm a string!.";
- char a[50] = "This is a string in an array called a.";
- printf("Size of s is: %i\n", sizeof(s));
- printf("Size of *s is: %i\n", sizeof(*s));
- printf("Strlen of s is: %i\n", strlen(s));
- printf("\n");
- printf("Size of a is: %i\n", sizeof(a));
- printf("Size of *a is: %i\n", sizeof(*a));
- printf("Strlen of a is: %i\n", strlen(a));
- return 0;
- }
- /* Output is:
- Size of s is: 4
- Size of *s is: 1
- Strlen of s is: 70
- Size of a is: 50
- Size of *a is: 1
- Strlen of a is: 38
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement