Common C programming mistakes

Posted on Sun 27 September 2015 in blog

I've decided to compile a list of common programming mistakes when using C.

Random numbers

Q: Why is my program generating the same random numbers?
A: You're probably re-seeding the PRNG. You should call srand() just once, at the beginning of your program. From then on, just avoid concurrent accesses to rand().