#include<stdio.h>
void trim(char *text)
{
/* remove trailing spaces */
char *p;
p = &text[strlen(text) - 1];
while(*p == 32 && p >= text)
*p-- =0;
}
int main(){
char text[]="Hello World ";
printf("Length Of String Before Trim : %d\n", strlen(text));
trim(text);
printf("Length Of String Before Trim After Trim : %d\n", strlen(text));
system("pause");
return 0;
}
void trim(char *text)
{
/* remove trailing spaces */
char *p;
p = &text[strlen(text) - 1];
while(*p == 32 && p >= text)
*p-- =0;
}
int main(){
char text[]="Hello World ";
printf("Length Of String Before Trim : %d\n", strlen(text));
trim(text);
printf("Length Of String Before Trim After Trim : %d\n", strlen(text));
system("pause");
return 0;
}