Advertisement
alunux

string-literal.c

Nov 11th, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.43 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. const char *whoami(void)
  4. {
  5.     const char *me = "newbie";
  6.  
  7.     printf("%s at %p\n", me, me);
  8.     return me;
  9. }
  10.  
  11. int main(void)
  12. {
  13.     const char *p;
  14.     const char *name = "alunux";
  15.  
  16.     p = name;
  17.     printf("%s at %p\n", name, name);
  18.     name = "wonderneko";
  19.     printf("%s at %p\n", name, name);
  20.     printf("%s at %p\n", p, p);
  21.     p = name;
  22.     printf("%s at %p\n", p, p);
  23.     p = whoami();
  24.     printf("%s at %p\n", p, p);
  25.  
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement