Are the loops in your addToArray function straight? If the data types of i and SIZE are not the same like Jason said, then thats the only other thing that may be the problem. Unless, of course the infinite loop is in another part of your code.
Peace out.
So monkey, do you actually need to change the size of the elements of your array or change the actual number of elements in the array? If it is the latter, then you can use calloc(numEls, elemSize) to dynamically allocate space for an array at run-time.
Let me know what happens.
Sam
Maybe in the last else block you should use
strcmp(...) instead of != in the two if conditions inside the loop? Actually, I don't think thats gona help, but you never know.
When you do get the answer can you post it (its an interesting problem)? Which libraries did you include for this...
Theoretically, given a linked list, how can you tell if there is a "loop" in it (i.e. one node is being pointed to by more than one other node)??
Then, how can you tell where the "loop" starts??
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.