How to Run C Program in Command Prompt Using GCC

How to Run C Program in Command Prompt Using GCC – In this tutorial we will discuss step by step approach on how to run c program in command prompt/cmd in windows.

To run C program in command prompt using gcc, you will need GCC compiler.

Gcc Compiler

So first check whether your computer has gcc installed or not.

  1. Open CMD (Command Prompt ).
  2. Type

    Gcc compiler install
    How to Run C Program in Command Prompt Using gcc – In this tutorial we will discuss step by step approach on how to run c program in command prompt/cmd in windows.

    and hit Enter

  3. If it prompts that “gcc not recognized“. Then follow “Install gcc in windows” .
  4. If already installed then go directly to “Run C Program in Command Prompt Using gcc” Section Below.

Install GCC in windows

Open SourceForge TDM-GCC MinGW Compiler.

Run C Program

Download GCC compiler for windows by clicking the download button.

Run gcc compiler setup to install gcc compiler.

run gcc in cmd

How to Run C Program in Command Prompt Using gcc

Run C Program in Command Prompt

gcc compiler installer windows

Open command prompt and Type

and hit Enter. This time you will see something like this as stated in the picture.

Run C Program in Command Prompt Using gcc

You have successfully installed GCC Compiler in windows.

Run C Program in Command Prompt Using GCC

Navigate to the directory where your program file is located. Use C: or F: or D: to change drive. And “cd” to change directory.

OR

you can press Shift + right click on the free space of the window containing your program file. Choose Open command window here.

Run C Program in cmd

Now type

in the command prompt. If your program doesn’t contain any error then the cmd will show nothing. Otherwise errors will be displayed.

Once your program is error free. Compile using gcc filename.c

How to Run C Program in cmd Using gcc

To run the program for output, Type

and press Enter.

how to run c program in ubuntu

Also read:

Merge Sort in C.

Counting Sort in C++.

Shell Sort in C++.

Quicksort in C++ using recursion.

admin

I am a B.tech IT Student from India. Technology and programming is the most enthusiastic thing for me in this world. I like learning new techniques and use them for real-world application because I feel tech is future. Let's learn and grow TOGETHER.