Functions calling themselves are called recursive functions. Might be of help for you when researching.

Anyhow, I think it's relating to how you pass your pointer to the function, maybe resulting in an infinite loop at the first function. Try without the loops but just a small counter (and global counter variable), does it still crash? Try to think of more testcases to get the piece of code causing the crash. Because recursive functions work fine, I did it.


Click and join the 3dgs irc community!
Room: #3dgs