Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

4
  • 4
    lst[i] = malloc(sizeof(char)*(len/2)); 1) this will allocate too little if the string length happens to be odd 2) you also need space for the two '\0' terminators in the result strings. 2a) you need to null-terminate the resulting strings 3) (*lst)[0]=s[i]; this is just wrong. What is your intention here? Commented Jan 25, 2017 at 14:15
  • C strings are null terminated arrays and it looks like you forgot to process those nulls... Commented Jan 25, 2017 at 14:19
  • @wildplasser I changed it to *(lst[0])=s[i]. I'm trying to access to the first char array Commented Jan 25, 2017 at 14:26
  • @SergeBallesta How would I do that? Commented Jan 25, 2017 at 14:29