Advertisement
yanni_yagami

Untitled

Apr 18th, 2019
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.55 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. int main(int argc, char *argv[]) {
  6.     char *first, *second;
  7.  
  8.     first = malloc(22);
  9.  
  10.     if(first == NULL) {
  11.         fprintf(stderr, "error : dynamic memory allocation.\n");
  12.         exit(EXIT_FAILURE);
  13.     }
  14.  
  15.     second = malloc(22);
  16.  
  17.     if(second == NULL) {
  18.         fprintf(stderr, "error : dynamic memory allocation.\n");
  19.         exit(EXIT_FAILURE);
  20.     }
  21.  
  22.     strcpy(first, argv[1]);
  23.     strcpy(second, argv[2]);
  24.  
  25.     free(first);
  26.     free(second);
  27.  
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement