Guest User

Untitled

a guest
Aug 4th, 2020
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.41 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. int main()
  4. {
  5.     char c;
  6.     char* mas = malloc(sizeof(char));
  7.     char* start = mas;
  8.     while((c = getchar()) != EOF)
  9.     {
  10.         *(mas) = c;
  11.         mas++;
  12.         start = realloc(start,  mas-start);
  13.     }
  14.     printf("\n");
  15.     for(char* it = mas; it >= start; it--)
  16.     {
  17.         printf("%c", *it);
  18.     }
  19.     printf("\n");
  20.     free(start);
  21.     return 0;
  22. }
  23.  
Advertisement
Add Comment
Please, Sign In to add comment