Stack using array v1.0 The while loop runs infinitely if exit(0) is removed