This is a program that delete spaces in the beginning and the end of a string c, can you tell me please where is the error in it ? I already tried running it in the debuger. It seems that the while loops aren't executed, kind of neglecting.
#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
#include <string.h>
void main()
{
char c[1000],d[1000];
gets(c);
int i=0,j=strlen(c)-1;
while (c[i]==" ")
{
i++;
}
while (c[j]==" ")
{
j--;
}
int k,l=0;
for (k=i;k<=j;k++)
{
d[l]=c[k];
l++;
}
printf(d);
}