![]() |
VOOZH | about |
C is a commonly used programming language developed in the 1970s by Dennis Ritchie. It is known for providing low-level memory access, which makes it ideal for system programming and embedded systems. To start programming in C, we should be able to run or execute C source codes. We have two ways to run C codes:
Onlinе IDEs offer a convenient option for those who choose not to set up a local environment. You just need to enter your code and press a button. An example is the C Compiler IDE by GeeksforGeeks.
GeeksforGeeks also provides an option to run the code in the article itself just by clicking the play button on the top right corner of the code snippet.
Learning C at GeekforGeeks
Installing C in your own computer requires downloading and installing two software that together forms the C development environment:
There are many C compilers provided by different vendors available. Below are the instructions for installing GCC (GNU Compiler Collection) on different operating systems.
To install GCC on Linux (Ubuntu, Debian, Linux Mint, and Kali Linux), you can use the apt package manager. Just enter and run the following commands one by one in the terminal:
The above command will download and install GCC in your system.
To install GCC on Windows, we can use MinGW (Minimalist GNU for Windows) installer. Follow these steps:
On macOS, GCC can be installed using Homebrew package manager. First install Homebrew in macOS using the following command:
Then enter the following command to install GCC:
We can check if the GCC compiler is successfully installed on the operating system by using the following command in the command line interface:
If the installation was successful, below text is shown:
There are many IDEs available on the internet for free use. One popular code editor is VS Code, which is an excellent and lightweight code editor. Follow the below steps to install VS code:
Step 1: Download the suitable VS Code installer according to your operating system.
Step 2: Once downloaded, open it and install the VS Code with recommended settings.
For installing different IDEs, you can refer to the articles given below:
As GCC is already added to PATH, then we don't need to explicitly tell VS Code the installation directory of the compiler. But we still can do a few things to make C development easier.
Install C/C++ Extension Pack and Code Runner extensions by:
By default, code runner runs the program in the output console in which we can't give input to the program from the terminal. To change this:
Let's run a simple program to check if everything is fine.
As we can see, our local C development environment is ready to use!