Section 3. Chapitre 6
single
Challenge: Concatenating Strings
Glissez pour afficher le menu
Tâche
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.
Solution
Tout était clair ?
Merci pour vos commentaires !
Section 3. Chapitre 6
single
Demandez à l'IA
Demandez à l'IA
Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion