943,871 Members | Top Members by Rank

Ad:
  • C Discussion Thread
  • Unsolved
  • Views: 9156
  • C RSS
Jun 23rd, 2008
-2

c program to remove blank spaces

Expand Post »
plz provide the c program to remove the blank spaces
Similar Threads
Reputation Points: 6
Solved Threads: 0
Newbie Poster
sivakrishna is offline Offline
2 posts
since Jun 2008
Jun 23rd, 2008
0

Re: c program to remove blank spaces

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.
Reputation Points: 416
Solved Threads: 181
Nearly a Posting Virtuoso
Adak is offline Offline
1,463 posts
since Jun 2008
Jun 24th, 2008
0

Re: c program to remove blank spaces

Quote ...
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.
Reputation Points: 193
Solved Threads: 25
Posting Pro
Jishnu is offline Offline
518 posts
since Oct 2006
Jun 24th, 2008
0

Re: c program to remove blank spaces

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.
Reputation Points: 2143
Solved Threads: 178
Posting Maven
jephthah is offline Offline
2,567 posts
since Feb 2008
Jun 24th, 2008
1

Re: c program to remove blank spaces

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.

  1. character [] source = " We dont do your homework "
  2. charater [] destination;
  3.  
  4. Fetch each char from the source array
  5. Check if the fetched char is white space char
  6. if so continue the loop
  7. if not space char
  8. copy that char into destination
  9.  
  10. print the destination ( with no white space in it )

ssharish
Reputation Points: 73
Solved Threads: 20
Posting Whiz in Training
ssharish2005 is offline Offline
253 posts
since Dec 2006
Jun 25th, 2008
0

Re: c program to remove blank spaces

If this is not enough! then only God can help you.

oops!! not even God.
Reputation Points: 83
Solved Threads: 61
Posting Pro in Training
Luckychap is offline Offline
442 posts
since Aug 2006
Jun 27th, 2008
0

Re: c program to remove blank spaces

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

Good luck ;-)
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Nashy is offline Offline
5 posts
since Jun 2008
Jul 2nd, 2008
0

Re: c program to remove blank spaces

Click to Expand / Collapse  Quote originally posted by jephthah ...
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:
python Syntax (Toggle Plain Text)
  1. text = text.replace(' ', '')
Reputation Points: 625
Solved Threads: 211
Posting Virtuoso
Ene Uran is offline Offline
1,704 posts
since Aug 2005
Jul 2nd, 2008
0

Re: c program to remove blank spaces

So does Perl! In fact, you can do it with just one line, on the command line.
  1. 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.
  1. for each character in the string
  2. if the character isn't a space
  3. print it
  4.  
Reputation Points: 185
Solved Threads: 28
Posting Whiz in Training
dwks is offline Offline
269 posts
since Nov 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C Forum Timeline: Contrast calculation
Next Thread in C Forum Timeline: Problem using atoi for my argv argument





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC