Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. int main()
  6. {
  7.     char *s = "This is a string in memory pointed to by s, look at me. I'm a string!.";
  8.     char a[50] = "This is a string in an array called a.";
  9.  
  10.     printf("Size of s is: %i\n", sizeof(s));
  11.     printf("Size of *s is: %i\n", sizeof(*s));
  12.     printf("Strlen of s is: %i\n", strlen(s));
  13.     printf("\n");
  14.     printf("Size of a is: %i\n", sizeof(a));
  15.     printf("Size of *a is: %i\n", sizeof(*a));
  16.     printf("Strlen of a is: %i\n", strlen(a));
  17.     return 0;
  18. }
  19.  
  20. /* Output is:
  21.  
  22. Size of s is: 4
  23. Size of *s is: 1
  24. Strlen of s is: 70
  25.  
  26. Size of a is: 50
  27. Size of *a is: 1
  28. Strlen of a is: 38
  29.  
  30. */