Understanding programming question


using strncpy and strncar functions:

void safe_concat(cnst char a[], const char b[], char result[], int result_maxlength)

implement a function that concatenates the strings a and b to the buffer result. Be sure not to overrun the buffer. It can hold result_maxlength characters, not counting the '\0' terminator.

I have a hard time understanding what this question is asking, do i ask the user to enter two separate characters and just add them together into an array of vector?
It doesn't sound like you need to accept any input from the user. You simply have to define the function, and the strings to be concatenated are given as inputs to the function.

Let's say that string a is "blah" and string b is "wow", and result_maxlength is 7. Should the function save anything into the buffer in this case? Think about the checks you need to do to make sure that the concatenated result will fit into the buffer, and then use the suggested library functions to help you. Post up your code if you get stuck.
Topic archived. No new replies allowed.