Advertisement
Guest User

Untitled

a guest
Jul 15th, 2015
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <cstdio>
  5. #define SYSTEMCODE 1
  6.  
  7. int main()
  8. {
  9. char *str;
  10. /* Initial memory allocation */
  11. str = (char *) malloc(SYSTEMCODE + 5));
  12. strcpy(str, "tutorialspoint");
  13. printf("String = %s, Address = %u\n", str, str);
  14.  
  15. /* Reallocating memory */
  16. str = (char *) realloc(str, 25);
  17. strcat(str, ".com");
  18. printf("String = %s, Address = %u\n", str, str);
  19.  
  20. free(str);
  21.  
  22. return(0);
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement