To elaborate on WizenedEE's correct reply if you make the variable static it's value will be retained when the function is exited so when you call the function again it will have the value it had previously. If you don't make it static then the memory space required to hold that variable is made available when the function exits. So the cost of a static variable is memory space. statics have their place but shouldn't be used unless necessary.