From 5c1292a6d7c86f7bddec858cc67b761f10045cac Mon Sep 17 00:00:00 2001 From: oraqlle <41113853+oraqlle@users.noreply.github.com> Date: Tue, 25 Apr 2023 14:13:06 +1000 Subject: [PATCH 1/2] Updated wording for C challenge 8 - concatenate. --- src/chapter2/challenges.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/chapter2/challenges.md b/src/chapter2/challenges.md index 1dcb954..e2e1edf 100644 --- a/src/chapter2/challenges.md +++ b/src/chapter2/challenges.md @@ -51,4 +51,6 @@ This challenge involves implementing the sum and product reductions on an array ## Challenge 8 - Array Concatenation -In this challenge you have to implement a general array concatenation function. This should join two arrays of the same type into a single array similar to `strcat()`. As an extra challenge, implement this concatenation algorithm so that if the destination buffer is not large enough, a new buffer of the required size is created and returns the pointer to the new buffer. +In this challenge you have to implement an array concatenation function. This should join two arrays of the same type into a single array, similar to `strcat()`. You will need to allocate a new block of memory and in order to store the concatenated arrays which will requires the sizes of the two input arrays to be known by the function. This function should return a pointer to the resulting array. + +> Note: The type of the array this function concatenates can be any type except `char`. From 6e707f0543d52d14afb17aec57fa038367248175 Mon Sep 17 00:00:00 2001 From: oraqlle <41113853+oraqlle@users.noreply.github.com> Date: Tue, 25 Apr 2023 14:13:06 +1000 Subject: [PATCH 2/2] Updated wording for C challenge 8 - concatenate (#34). --- src/chapter2/challenges.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/chapter2/challenges.md b/src/chapter2/challenges.md index 1dcb954..e2e1edf 100644 --- a/src/chapter2/challenges.md +++ b/src/chapter2/challenges.md @@ -51,4 +51,6 @@ This challenge involves implementing the sum and product reductions on an array ## Challenge 8 - Array Concatenation -In this challenge you have to implement a general array concatenation function. This should join two arrays of the same type into a single array similar to `strcat()`. As an extra challenge, implement this concatenation algorithm so that if the destination buffer is not large enough, a new buffer of the required size is created and returns the pointer to the new buffer. +In this challenge you have to implement an array concatenation function. This should join two arrays of the same type into a single array, similar to `strcat()`. You will need to allocate a new block of memory and in order to store the concatenated arrays which will requires the sizes of the two input arrays to be known by the function. This function should return a pointer to the resulting array. + +> Note: The type of the array this function concatenates can be any type except `char`.