
Enviado em 04/12/2021 - 04:03h
Bom dia a Todos.#include <stdio.h>
char *strcat_for(char *Dest, char *Src) {
int x = 0;
for( ; Dest[x] != '\0'; x++);
for(int y = 0; Src[y] != '\0'; y++, x++)
Dest[x] = Src[y];
Dest[x] = '\0';
return Dest;
}
char *strcat_while(char *Dest, char *Src) {
while(*Dest)
Dest++;
while(*Src)
*Dest++ = *Src++;
*Dest = '\0';
return Dest;
/* Mesmo sem usar ponteiros não funciona igual ao for
int x = 0, y = 0;
while(Dest[x] != '\0')
Dest++;
while(Src[y] != '\0')
Dest[x++] = Src[y++];
Dest[x] = '\0';
return Dest;
*/
}
int main(void) {
char for1[15] = "for", while1[15] = "while", End[] = " 2022";
puts(strcat_for(for1, End)); // Funciona!
//puts(strcat_while(while1, End)); // Não funciona, não imprime, Porque?
// O While só funciona assim, Porque?
strcat_while(while1, End);
puts(while1);
}
Gentoo binário em 2026: UEFI, LUKS, Btrfs e Systemd
Trabalhando Nativamente com Logs no Linux
Jogando Daikatana (Steam) com Patch 1.3 via Luxtorpeda no Linux
LazyDocker – Interface de Usuário em Tempo Real para o Docker
Usando dracut e dispensando genkernel no Gentoo + LUKS + Btrfs
Curso GRÁTIS: OCS Inventory NG - Do Deploy ao Hardening com foco em Segurança da Informação!
Instalando fontes via script no Nautilus Scripts no Gnome do Debian 13
Removere linux-image-6... [RESOLVIDO] (2)
Quando vocês pararam de testar distros? (19)
O que houve com slackware ??? (6)









