Ad
  • Custom User Avatar

    Of course, my mistake,

  • Custom User Avatar

    I have a few question/observations about this approach:

    1. With every word you append you walk the whole “prev” string to strlen it and allocate/free a new buffer, isn't this an O(N²) time & heap churn?
    2. Isn't there an off‐by‐one over-allocation? calloc(strlen(prev)+1+strlen(words[i])+1), doesn't this actually give you one extra byte?
    3. In your loop, it looks like there's a mismatch between int i vs size_t count.