Seksjon 3. Kapittel 6
single
Challenge: Concatenating Strings
Sveip for å vise menyen
Oppgave
Swipe to start coding
Practice concatenating strings safely in C by implementing a function that appends the contents of one string to another, making sure not to exceed the destination buffer's size and always ensuring the result is null-terminated.
- Append the contents of
srcto the end ofdestwithout exceedingdest_size - 1characters indest. - Ensure the resulting string in
destis always null-terminated. - Only append as many characters from
srcas will fit in the remaining space ofdest. - Do not modify characters in
destbeyond the allowed buffer size.
Løsning
Alt var klart?
Takk for tilbakemeldingene dine!
Seksjon 3. Kapittel 6
single
Spør AI
Spør AI
Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår