Compiling C code in the terminal

You are compiling the code, not running it, the correct procedure is:

  • Create the source file (test.c)
  • Compile it with gcc test.c -o test
  • Run it with ./test

Also you can make a oneliner with these commands:

gcc test.c -o test; ./test