Changed int to unsigned int almost everywhere and added -O2 optimization flag
Added consts and fixed bug with outputError not being inside the loop in trainNetwork()