Advertisement
wojtas626

[C] JiMP 10.2

Dec 9th, 2014
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.35 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. int main(void) {
  6.     char *wyrazy[5];
  7.     int i;
  8.  
  9.     for (i = 0; i < 5; i++) {
  10.         char* x;
  11.         x = malloc(128);
  12.         scanf("%s", x);
  13.         wyrazy[i] = malloc(strlen(x) + 1);
  14.         strcpy(wyrazy[i], x);
  15.     }
  16.  
  17.     for (i = 0; i < 5; i++) {
  18.         printf("%s\n", wyrazy[i]);
  19.         free(wyrazy[i]);
  20.     }
  21.  
  22.     return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement