Advertisement
Guest User

Untitled

a guest
Oct 17th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.44 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <stdbool.h>
  4.  
  5. int main ()
  6. {
  7.     int size = 0;
  8.     int *a = (int*)malloc(size*sizeof(int));
  9.     int j;
  10.     bool tstr = 1;
  11.     char c;
  12.     while(c != '\n'){
  13.         a = (int*)realloc(a, (size+1)*sizeof(int));    
  14.         scanf("%d%c", &a[size++], &c);
  15.     }
  16.     for(int i =0, j = size -1; i<j && tstr; i++, j--)
  17.         tstr = (a[i] == a[j]);
  18.     printf("%s\n", tstr? "yes": "no");
  19.     free(a);
  20.     return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement