How To Run A C File In Terminal?

Save the file with a `.c` extension

Open the terminal

Navigate to the folder containing the file

Compile the file with `gcc filename.c -o outputname`

Run the compiled program with `./outputname`

If `gcc` is not installed, install a C compiler first

On Windows, use `gcc filename.c -o outputname.exe` and run `outputname.exe` in the terminal

Suggested for You

Trending Today