Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. char *MakeString(char *localZ)
  5. {
  6.     localZ = "Ipsum Lorem\0";
  7.     printf("The string localZ points to is %s\n", localZ);
  8.     printf("The addy contained in localZ in local function is %p\n", localZ);
  9.     printf("The addy OF localZ in local function is %p\n\n", &localZ);
  10.     return localZ;
  11. }
  12.  
  13. int main()
  14. {
  15.     char *mainZ = "Test123\0";
  16.  
  17.     printf("The string mainZ points to is %s\n",mainZ);
  18.     printf("The addy contained in mainZ is %p\n",mainZ);
  19.     printf("The addy OF mainZ is %p\n\n",&mainZ);
  20.  
  21.     printf("\n\nNow we call the function to alter mainZ\n\n");
  22.  
  23.     mainZ = MakeString(mainZ);
  24.  
  25.     printf("The string mainZ points to is %s\n",mainZ);
  26.     printf("The addy contained in mainZ is %p\n",mainZ);
  27.     printf("The addy OF mainZ is %p\n",&mainZ);
  28.  
  29.     return 0;
  30. }