So...let's recap:

(Type) vi [filename]
(To edit file - press) i
(To stop editting) ESC
(To Save and quit) :wq!
(In the shell, give permissions) chmod 755 [filename]
(Assuming you had !/bin/bash, run) ./[filename]
(If not) bash [filename
Don't forget to compile it if you need to. ;-)

As MsM said
gcc filename.c -o filename
then
./filename

MB