C Programming for Beginners : Get Started within 5 minutes

Suraj Das
5 min readOct 21, 2021

--

Photo by Dawid Zawiła on Unsplash

Here is Why you Should Learn C Programming

C is a powerful general-purpose programming language. It is a middle-level language which means learning C can be a bit harder than learning a high-level language like Python.
But you can just sit back and relax cuz you will be going through a beginner friendly blog on C Programming.

Most universities makes you learn C as your first programming language because of several reasons.

  • C is a procedural language. It helps your algorithmic thinking.
  • Features of C language include low-level access to memory, simple set of keywords, and clean style.
  • It helps us to understand the underlying architecture of how computers works.
  • It contains concepts like pointers, memory locations, etc. which is beneficial for understanding how operating systems work.
  • Learning a modern programming language will be just a piece of cake for you if you learn C. Basically, C is the mother of all modern programming languages.
  • C is fast in terms of execution time.

Now I think these bullet points are enough to make you learn C :)

:: This course is better for windows users.

Installation of VS Code

We should get a stress free approach when it comes to installation process.
Clean steps to follow :

  1. Download VS Code.
    This is where we will be writing our C code.
    Click on this link and choose your OS : https://code.visualstudio.com/download
  2. Open VS Code Setup which you just downloaded.
  3. Install VS Code correctly. Make sure these options are checked while installing VS Code on your PC.
Accept the agreement
Check these options

Congratulations on installing your text editor :)

Opening VS Code should look like this :

VS Code

Running your first line of C code

  • Create a folder named “CFolder” on your Desktop.
  • Open VS Code and watch over the left (your left) section.
    Click on Open Folder.
  • Select your folder and open it.
  • Give VS Code the permission to open the folder by clicking Yes.
  • At last, Create a new file and name if as “helloWorld.c”.
    Remember to type the extension (.c) after the file name.
    .c is the extension for c files.

Now this is where you can write your C code.

But the computer can’t understand your C code as computers can only understand machine code. For that we need a bridge which can convert our C code to machine code.

The compiler which can do this is gcc compiler.

So now, we need to install gcc compiler and for that we will be installing MinGW.

Steps to install MinGW (for windows)

MinGW Settings
  • After clicking Next, make sure to copy the Destination Path by pressing CTRL + C. And paste it somewhere else cuz it will be used later.
  • After saving the path somewhere, edit the path and add this text to the end of the path : \mingw64\bin
    And save it.
  • Click next and complete the installation process.

Integrate MinGW with VS Code

  • Open the Control Panel of your PC.
  • Click on Systems and Security.
  • Click on Systems.
  • Click on Advanced system settings which will be on the left side section.
  • It will open a dialog box. Click on Environment Variable which will be at the bottom.
  • Click on Path variable and click on Edit.
  • Click New
  • There, paste the the Destination Path there. And click Okay.
  • Click OK on each and every dialog box you’ve opened.
  • Now, restart your VS Code.
  • On the top, Click on Terminal.
  • Click on Configure Default Build Tasks.
  • Select the build task.

Congratulations! Now you are good to go with your C code.

Install CodeRunner extension on VS Code

  • Open VS Code and press CTRL + Shift + X.
  • Type Code Runner on the search bar.
  • Click on install

First C Program

Don’t worry. You don’t have to understand the syntax now. Just copy and paste this code and run it to check if it is working or not.

#include <stdio.h>int main(){
printf("Hello World!\n");
return 0;
}

After pasting the code, press CTRL + Alt + N to run the code.

It will print :

Hello World!

Hurray you just created your room for C Programming.

Follow for the upcoming lessons and good luck to your journey on C Programming :)

Peace.

Index of C Programming lessons :

  1. Getting Started within 5 minutes
  2. Learning Fundamentals Made Easy
  3. Circumference and Area of Circle
  4. scanf() vs fgets()
  5. Hypotenuse Calculator
  6. Learn by Building a Calculator
  7. Functions
  8. More on Functions
  9. Length of an Array
  10. String Functions
  11. The While Loop

--

--