I was trying to generate a function that will delete all the spaces from a given passage. I was successful....my program may look a bit clumsy....but it is working on pretty fine....

Code: C
#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<malloc.h>

char *spacedel(char *a)
{
    char *b;
    int i, j, c=0, l=strlen(a);
    for(i=0;i<l;i++)
    {
        if(*(a+i)==' ')
            c++;
    }
    b=(char *)malloc((l-c)*sizeof(char));
    i=0;
    j=0;
    while(i<l && j<(l-c))
    {
        if(*(a+i)==' ')
            i++;
        else
        {
            *(b+j)=*(a+i);
            i++;
            j++;
        }
    }
    return(b);
}

void main()
{
    char a[]="C is the philosophy of life.";
    char *b;
    b=spacedel(a);
    printf("\n%s", b);
    getch();
}

Immediately after this I was given an assignment to retreat the sentence, I mean say the sentence initially given was...

Code:
C is the philosophy of life.
After running through my program it becomes...
Code:
Cisthephilosophyoflife.
Now, I have to retain it to its original form.....with the use of another function....

How on the earth am I gonna do that???????
Please help....I am getting confused even in tracing out my process....