C program remove spaces or blanks from a string
C program remove spaces or blanks from a string, For example consider the string
"c programming"
There are two spaces in this string, so our program will print a string
“c programming”. It will remove spaces when they occur more than one time consecutively in string anywhere.
[ad type=”banner”]C programming code
[pastacode lang=”c” manual=”%23include%20%3Cstdio.h%3E%0A%20%0Aint%20main()%0A%7B%0A%20%20%20char%20text%5B1000%5D%2C%20blank%5B1000%5D%3B%0A%20%20%20int%20c%20%3D%200%2C%20d%20%3D%200%3B%0A%20%0A%20%20%20printf(%22Enter%20some%20text%5Cn%22)%3B%0A%20%20%20gets(text)%3B%0A%20%0A%20%20%20while%20(text%5Bc%5D%20!%3D%20’%5C0′)%20%7B%0A%20%20%20%20%20%20if%20(text%5Bc%5D%20%3D%3D%20’%20′)%20%7B%0A%20%20%20%20%20%20%20%20%20int%20temp%20%3D%20c%20%2B%201%3B%0A%20%20%20%20%20%20%20%20%20if%20(text%5Btemp%5D%20!%3D%20’%5C0′)%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20while%20(text%5Btemp%5D%20%3D%3D%20’%20’%20%26%26%20text%5Btemp%5D%20!%3D%20’%5C0′)%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20if%20(text%5Btemp%5D%20%3D%3D%20’%20′)%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20c%2B%2B%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D%20%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20temp%2B%2B%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20blank%5Bd%5D%20%3D%20text%5Bc%5D%3B%0A%20%20%20%20%20%20c%2B%2B%3B%0A%20%20%20%20%20%20d%2B%2B%3B%0A%20%20%20%7D%0A%20%0A%20%20%20blank%5Bd%5D%20%3D%20’%5C0’%3B%0A%20%0A%20%20%20printf(%22Text%20after%20removing%20blanks%5Cn%25s%5Cn%22%2C%20blank)%3B%0A%20%0A%20%20%20return%200%3B%0A%7D” message=”” highlight=”” provider=”manual”/]If you want you can copy blank into text string so that original string is modified.
Output of program:


Super concept
it is really amazing!