Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2017
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.26 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. void squeeze(char s[], int c);
  4.  
  5. int main() {
  6.     char s[] = "ccabc";
  7.     squeeze(s, 'c');
  8.     printf("%s\n", s);
  9. }
  10.  
  11. void squeeze(char s[], int c) {
  12.     int i, j = 0;
  13.  
  14.     while(s[i] != '\0') {
  15.         if (s[i] == c) {
  16.             s[i] = '\0';
  17.         }
  18.         ++i;
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement