Antes d tudo comprimento a todos !
Estava tentando simular a função strcat() e deu nisso aki em baixo, alguem pode me ajudar, me falar na onde errei, e também se possivel cirar a função strlen().
Obg !
Estava tentando simular a função strcat() e deu nisso aki em baixo, alguem pode me ajudar, me falar na onde errei, e também se possivel cirar a função strlen().
#include <stdio.h>
#include <string.h>
void StrCat(char *dest,char *orig){
while(*dest!='\0') dest++;
*(dest+1)=" ";
dest++;
while(*orig!='\0'){
*dest=*orig;
dest++;
orig++;
}
}
int main(){
char str1[100],str2[100];
printf("\nEntre com uma string: ");
gets(str1);
strcpy(str2,"Voce digitou o valor: ");
StrCat(str2,str1);
printf("\n%s\n",str2);
printf(" FIM... ");
return(0);
}
#include <string.h>
void StrCat(char *dest,char *orig){
while(*dest!='\0') dest++;
*(dest+1)=" ";
dest++;
while(*orig!='\0'){
*dest=*orig;
dest++;
orig++;
}
}
int main(){
char str1[100],str2[100];
printf("\nEntre com uma string: ");
gets(str1);
strcpy(str2,"Voce digitou o valor: ");
StrCat(str2,str1);
printf("\n%s\n",str2);
printf(" FIM... ");
return(0);
}
Comment