VS Code — How to Run C Right Away!
A light IDE, Finally!— Thank God, Bye MS VS Community App #CSeries — Episode #00
Welcome! in this post we will see how we can set up the Visual Studio Code for writing and executing the C/C++ programs.
1#Step — You Will need:
tdm-gcc
visualstudio.com
These are the C and C++ toolset and Visual Studio Code installer.
2#Step — So now first let us open up the Visual Studio code; you must install these extensions:
C and C++
Code Runner
Restart the Visual Studio code.
3#Step — Add a new workspace; Here we will gonna call it as C C++ WS; Save the folder inside this WS;
Let us create a file inside this folder vscode:
Now Let’s get some code!
4#Step — We will create a simple program like this (helloworld.c):
#include<stdio.h>int main(){
printf("Hello World!");
return 0;
}
To run this code first please open the PowerShell As Administrador and Give it permission (why?); Use the prompt :)
Type:
Set-ExecutionPolicy AllSigned
5#Step — Run the code now by pressing this button!
6#Step — Now How to Take Input? As the output tab is read-only let’s make another program to take it and seehow to get around this issue...
To get some user input, let us run this program (getinput.c) to force entry:
#include<stdio.h>int main(){
int age;
printf("Enter your age: ");
scanf("%d", &age);
printf("Your age is: %d", age);
return 0;
}
7#Step — Final step: Modify The Settings — You almost there! okay now we have to modify some settings so that this program can take some user input.
Go to:
File > Preferences > Settings > Extensions > scroll down a bit:Run Code Configuration > Run in terminal (check this one)
Come back to the code and right click the button again to run the code.
Now the code will run in the terminal :)
That’s all, folks! Hope that helps!
The reason I made the effort to bring this to you is that I wasted time trying to run the C code. I hope that in 3 or 4 minutes you start coding…this app is awesome, even Python can be run on it…click on it and a window will pop up instantly!
Thank you for reading.
I’ll see you later in the next post about C (searching algorithms)!
Bye!
👉Code link
References & Credits
Posts Related:
00 Episode#CSeries — VS Code — How to Run C Right Away! A light IDE, Finally! — thank god, Bye MS VS Community app (this one)
01 Episode#CSeries — MUSIC ALBUM_V2.C — This is a Deque in C — Searching Algorithms Studies
02 Episode#CSeries — Hash tables in C — This is a HashTable in C — Searching Algorithms Studies
03 Episode#CSeries — University Catalog V1 — This is a HashTable — Searching Algorithms Studies
04 Episode#CSeries — Bubble Sorting (Ascendant Algorithm) — This is a Simple Sorting — Searching Algorithms Studies
05 Episode#CSeries — Quick Sorting (Ascendant Algorithm) — This is a Quick Sorting — Searching Algorithms Studies
06 Episode#CSeries — Linear Search — This is a Linear — Searching Algorithms Studies
07 Episode#CSeries — Doubly Linked List — Searching Algorithms Studies(this one)
That’s All, Folks!