Error while writing strcat() using pointers

前端 未结 4 840
忘了有多久
忘了有多久 2021-01-15 22:52

I am trying to learn C with The C programming Language by K&R. I am trying to write a the strcat() program using pointers.

char         


        
4条回答
  •  不知归路
    2021-01-15 23:50

    The program tries to append characters to the literal string "stack". Don't do that; create an array of characters that's large enough to hold the result, copy the first string into the array, and then strcat the rest of the string.

    Oh, and name your function something other than strcat. That name is already taken.

提交回复
热议问题