Ad
  • Default User Avatar

    you do not allocate enough memory. count is the length of the input array, i.e. the number of strings. your string will always require more memory than that, for example if you join "ab" and "def" you need 2 ("ab") + 1 (space) + 3 ("def") + 1 (nul terminator) = 7 bytes. you need to calculate the correct buffer size before allocating memory.

  • Custom User Avatar

    Did you test your solution on your machine with an array which has only one element?
    Did you test your solution on your machine with NULL?