Guest User

Untitled

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