plz provide the c program to remove the blank spaces

No.

That's not what we do. The way it works is *you* post your code, and also post up a description of your problem or error with that code.

We will take a look at it and suggest ways of fixing it.

We don't *do* your homework, we help you with *your* code problems.

No.

That's not what we do. The way it works is *you* post your code, and also post up a description of your problem or error with that code.

We will take a look at it and suggest ways of fixing it.

We don't *do* your homework, we help you with *your* code problems.

Exactly. Also see the article 'How to ask questions the smart way' over here.

LOL

but seriously, if there ever was a problem that should be solved by Perl... this is it.

look into Perl. this is the kind of problem it's designed to do. and can do it in about 3 lines of code.

Well, ok i decided to give you hint but not the answer, here you go with some sample pesudo code. This should give you an idea on how to approch this problem.

character [] source = " We dont do your homework "
charater [] destination;

Fetch each char from the source array 
      Check if the fetched char is white space char
            if so continue the loop
      if not space char
         copy that char into destination 

print the destination ( with no white space in it )

ssharish

Comments
Nice pesudo code

It's very easy, you know yet the algoritmus how to make it,
now you should only implementation it!

Good luck ;-)

LOL

but seriously, if there ever was a problem that should be solved by Perl... this is it.

look into Perl. this is the kind of problem it's designed to do. and can do it in about 3 lines of code.

Python does it with one line:

text = text.replace(' ', '')

So does Perl! In fact, you can do it with just one line, on the command line.

perl -pe 's/\s/g'

But that's beside the point.

Note that ssharish's code works, but it might be more efficient to shift the data inside the array. Or even just print characters that aren't spaces.

for each character in the string
    if the character isn't a space
        print it
This article has been dead for over six months. Start a new discussion instead.