The OP's question had code (which was later on revised by the OP) with a lot of potential bugs to start with, which could have been causing a segmentation fault. It would have been inaccurate to exactly point out the section of the code where the actual problem was, at that point of time. So, I answered the question with my suggestions on what OP should try on the code, so that we could answer the question precisely. My answer did get upvotes, too, which does prove that people did agree with my viewpoint of answer. And "No", it's not commentary on the question nor could it have been a comment. The answer contained many solutions, because there were many problems in the question.
The original answer I posted:
A few points: * In the functions you need to use `realloc`. * You need to learn the use of `free()` function * You have to allocate memory to `datArr` and check if its successfully done, before storing string `s` in it. * You need to learn pointers too(referencing and de-referencing). * You must check if the pointers are NULL or not before using them. * Learn `memset()`.