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);
}
Servidor de Backup com Ubuntu Server 24.04 LTS, RAID e Duplicati (Dell PowerEdge T420)
Visualizar câmeras IP ONVIF no Linux sem necessidade de instalar aplicativos
Atualizar Debian Online de uma Versão para outra
Instalando Discord no Debian 13
Instalar driver Nvidia no Debian 13
Redimensionando, espelhando, convertendo e rotacionando imagens com script
Software livre - será que eu estou tão errado assim? (9)
Boot do PosRog so funciona em notebook (1)