Subscribe Us

banner image

Breaking News

How To Set Up Visual Studio Code For C Programming

1. Introduction

Visual Studio Code (VS Code) is a free and powerfull source-code editor made by Microsoft for Windows, macOS and Linux

It comes with built-in support for JavaScript, TypeScript and Node.js and has a rich ecosystem of extensions for other languages (such as C, C++, C#, Java, Python, PHP, Go) and runtimes (such as .NET and Unity).

In this tutorial you will learn how to set up VS code on your local environment for C and C++.

2. Requirement

  1.  MinGW 
  2. Visual Studio Code (VS Code)

3. Install VS Code extensions

  1. Open VS Code, Go to Start Menu > All Apps > Visual Studio Code > Visual Studio Code.
  2. Select the “Extensions view icon” on the Activity bar, or click on the File menu, select Preferences > Extensions
  3. Install “C/C++” extension
    1. Search for “C++”.
    2. Click the “Install” button to install the extension.


  4. Install “Code Runner” extension
    1. Search for “Code Runner”.
    2. Click the “Install” button to install the extension.

      vs code for c programming

  5. Now we have successfully installed code editor.

4. Install a compiler (MinGW)

Please visit the tutorial at : https://www.dndsandyra.web.id/2021/10/how-to-install-mingw-on-windows.html

5. Create C Program

To make sure the compiler is installed and configured correctly, we'll create the simplest C program.

  1. Click on the File menu, click on Add Folder to Workspace.

    vs code for c programming

  2. Browse your C workspace (folder), navigate to save workspace (folder) (ex: D:\Program\VSCode\).

    vs code for c programming

  3. Now create a new file called “hello.c” with the “New File” button in the File Explorer, or click on the File menu > click on New File.

    vs code for c programming

  4. Write and save your first C program. Press "Ctrl+S" to save. Ex :


    vs code for c programming

6. Compile and run C program in VS Code

Once you created your first C program it's time to compile and run your program.

  1. Select the “Run code icon” on the Editor Area, or Right click > click on Run Code.

    vs code for c programming

  2. You should see the output "Hello, DnD!".

    vs code for c programming

Thanks for reading!

No comments

Pembaca yang baik selalu meninggalkan komentar sesudah membaca ^_^
Terimakasih sudah mengisi komentar