Yeah....and that can be done while I'm sliding the pointer along the given string at the first time...
I can introduce a counter....
Whenever the pointer experiences a space, the current value of the counter will be stored in another array....that will give the locations of the space....

That fixes it much....I hope....

One more query, what if I have to write a program which contains multiple spaces....and I have to reduce them in single space....

e.g. Consider the following sentence...
Code:
C  is the    philosophy  of     life.
And I have to write it as....
Code:
C is the philosophy of life.
What program should I write?? Please give hint....

Of course, I have to write a function....and pass that sentence in it to get that output....

Last edited by back from retirement; 5Dec2008 at 13:47..