Advertisement
mhdew

Biva_debug

Apr 12th, 2020
282
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.62 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5.    char text[1000], blank[1000];
  6.    int c = 0, d = 0;
  7.  
  8.    printf("Enter some text\n");
  9.    gets(text);
  10.  
  11.    while (text[c] != '\0') {
  12.       if (text[c] == ' ') {
  13.          int temp = c + 1;
  14.          if (text[temp] != '\0') {
  15.             while (text[temp] == ' ' && text[temp] != '\0') {
  16.                if (text[temp] == ' ') {
  17.                   c++;
  18.                }  
  19.                temp++;
  20.             }
  21.          }
  22.       }
  23.       blank[d] = text[c];
  24.       c++;
  25.       d++;
  26.    }
  27.  
  28.    blank[d] = '\0';
  29.  
  30.    printf("Text after removing blanks\n%s\n", blank);
  31.  
  32.    return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement