+ 2

(C) How to use strcat across functions

Hello, I am wanting to use stcat to add strings across functions to the one string using pointers. I have been unable to figure out how to do this. In the attached code I have made an attempt to do this. What I want it to do is change the string in the main function using the helper functions - allowing me to carry the string across functions Please help! https://code.sololearn.com/ce2JRSvZ4D2t

21st Apr 2022, 5:58 AM
Cam UOR
Cam UOR - avatar
3 odpowiedzi
+ 4
This is an implentation of Ani Jona 🕊 reply. https://code.sololearn.com/c26Urgb3zqM7
21st Apr 2022, 6:19 AM
John Wells
John Wells - avatar
+ 5
To begin with, you need to pass a pointer to char, which is C's version of a string type. Secondly, you need to make sure that the target array is allocated large enough to hold all concatenated parts.
21st Apr 2022, 6:12 AM
Ani Jona 🕊
Ani Jona 🕊 - avatar
+ 3
Thank you so much!
21st Apr 2022, 6:41 AM
Cam UOR
Cam UOR - avatar