I cant make it stop. I've already tried everything I know, but i cant do this. It should stop after loop but it doesn't. I'm still learning that code language so please be understanding if it is silly mistake.
key and KEY_ESC aren't defined anywhere. I'm assuming its defined in your <allegro.h> header? Also, is key an array or a function? I would be surprised if it were an array.