Esta é uma pré-visualização de arquivo. Entre para ver o arquivo original
#include<stdio.h>
#include<stdlib.h>
#define MAX 100
char *TRIM(char[]);
int main()
{
printf("Procedimento TRIM.\n\n");
char str[MAX], *str2;
int a;
printf("String: "); fgets(str,MAX,stdin); //Lendo string
str2 = TRIM(str); //Chamando função
printf("\nString alfabetica: %s",str2); //Exibição
system("PAUSE>NULL");
return 0;
}
char *TRIM(char str[]){ //Procedimento TRIM
int x, y[MAX], z=0;
char str2[MAX];
for(x=0; x<MAX; x++){ //Guardando posição dos caracteres
if((str[x]>='a' && str[x]<='z') || (str[x]>='A' && str[x]<='Z') || (str[x]=='\0')){
y[z] = x;
z++;
}
}
for(x=0; x<z; x++){ //Passando apenas os cracteres para um novo vetor
str2[x] = str[y[x]];
}
return str2;
}