Advertisement
Guest User

Untitled

a guest
Nov 21st, 2019
102
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. #define SIZE 5
  3.  
  4. int main(void) {
  5.   char v[SIZE] = "abcde";
  6.   char c;
  7.   char res;
  8.  
  9.   scanf("%c", &c);
  10.  
  11.   for(int i = 0; i < SIZE - 1; i++) {
  12.     if(v[i] < c && c < v[i+1]) {
  13.       res = v[i+1];
  14.       v[i+1] = c;
  15.       SIZE++;
  16.       for(j = i+1; j < SIZE + 1; j++) {
  17.     v[j] = res;
  18.     res = v[j+1];
  19.       }
  20.     }
  21.   }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement