Answer the question
In order to leave comments, you need to log in
String problem in C: how to concatenate strings without library functions (old question removed)?
The task given to me is to "glue" two strings, which are initially given as an array of characters (in general, in C there is no need to do it differently). I tried to come up with a solution myself, but in the end I had to turn to the Internet, and this is what I found: code with source . How could the same thing be done, but with the help of traditional array processing? By the way, I can't use any library functions in my code, except for strlen().
(there was a problem with tags, advise the arrangement for the future, so that this does not happen again)
Answer the question
In order to leave comments, you need to log in
In general, the solution to the problem:
Take through strlen determine the lengths of strings A and B Select
an array of length strlen(A) + strlen(B) + 1
mempcy string A into a new array from the beginning, then memcpy string B into a new one with mixing by the length of string A , add '\0' to the end of the array.
By the way, I can't use any library functions in my code, except for strlen().
How could the same thing be done, but with the help of traditional array processing?
How could the same thing be done, but with the help of traditional array processing?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question