Advertisement
Guest User

Untitled

a guest
Aug 18th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.25 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <stdlib.h>
  4. #include <ctype.h>
  5.  
  6. int main() {
  7.  
  8.   char a[5] = "hello";
  9.  
  10.   char *cpy = malloc(strlen(a) * sizeof(char) + 1);
  11.  
  12.   strcpy(cpy, "hello");
  13.  
  14.   printf("%s %lu \n", cpy, sizeof(char));
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement