Today we’re gonna be looking into an introduction about the programming language C.
C is a general-purpose programming language and is still popular and widely used because it’s powerful and it’s known as the mother of all languages. Dennis Ritchie was the founder of C. Now let’s see how to set up the environment and start to code in C. Throughout the tutorial we’ll be using Visual Studio Code but you can use any IDE or text editor if your wish.
C program file
All the C programs are written into text files with the extension “.c” for example HelloWorld.c
Why should you choose C
- C is fast. As it directly compiles into machine language it is fast.
- If you learn C the other languages are easy to learn. C has a lot of syntaxes and hence other languages will be a lot easier.
- C is really popular. We can find C in many big tech companies like Google, YouTube, and Telegram Messenger.
- C is versatile. C can be used in the making of applications, hardware, and many other things.
Scopes of C
- C is used to build OS and many desktop applications.
- It is used in embedded systems as a computer system that is a combination of a computer processor, computer memory, and input/output peripheral devices.
- It is used in making many other modern-day programming languages like Python, C++, Java, JavaScript and etc.
- Used for making the compiler and some IoT apps.
Setting up your environment
Download visual studio code or VS code from this link. After setting up, open the command palette (press ctrl+P) and paste the following command ext install ms-vscode.cpptools
. Also do the below processes.
For windows
- Download and install MinGW.
- In the setup wizard, choose your installation location and give continue.
- Once the installation is done click continue and the MinGW installation manager opens up.
- There we’ll be only installing the Mingw32-base package and Ming32-gcc-g++ package. Find them and select “Mark for Installation”. On the header, you’ll find the “Installation” tab click on that and give “Apply Changes” then “Apply”
- Click on the “Close” button once the installation is over.
Now we’ll be setting up MinGW
- Go to the installation directory and go into the “MinGW” folder and then open the “bin” folder. Now copy the path.
- Now go to “This PC” then right-click on it. Then select “Properties” then go to “Advanced system settings” now click on “Environment Variables”.
- Now in the “System variables” select “Edit” and go to “New” paste the path then give “OK”
- Now open the command prompt (cmd) then type in
gcc -version
there and press enter. If you see the version without getting any error, then congrats you’ve successfully finished setting up Min GW
For Linux
- Check if GCC is installed with
gcc -v
- If not install it with:
sudo apt update
sudo apt install build-essential
sudo apt-get install manpages-dev
Writing your first code
Now open your file manager and create a new folder for saving your C programs. Open the newly created folder in your VS code by giving the “open folder” option or simply by giving “Ctrl+K” and “Ctrl+O” one after the other. Now we’ll create a new text file by giving “Ctrl+N” then select your language as C then paste the following code:
#include <stdio.h>
void main() {
printf("hello,world!");
return 0;
}
Save the code as helloWorld.c
.
Running the program
To run the program in Linux:
- Open your terminal
- Run command
cd <path>
then give the path instead of the “<path>” - Now type in
./"nameOfYourFileHere"
which is in this case helloWorld so the command is./"helloWorld"
- And yeah you can see the Output on the screen
Output

Explanation of the above code
Here the #include <stdio.h>
simply imports the stdio.h module that stands for Standard Input Output into the program. void main()
creates the main() function where we’ll put all the code that’s to be executed. printf("hello world");
prints the message hello world in the console.
If you wanna know more about programming in C check out : C category