How to Run C in Visual Studio Code on Windows 11 2022 Best Code Editor

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey guys if you're looking for how you can run c program in your favorite visual studio code then you are in the right place watch this video until the end because i'm about to show you step by step process to configure visual studio code for running c programs correctly and i'm also gonna show you how you can code your first c program in visual studio code on windows 11. so without further ado let's get started [Music] firstly we have need to download and install the c compiler the best suited for our job is mingw to download it copy this link i have provided this link in the video description now open up your favorite web browser i am using google chrome here then paste the copied link into the search bar and hit enter this is a step-by-step detailed blog post explaining how to download and install c compiler and finally configure visual studio code to run c programs on windows 11. scroll up and find step 1. here look for download mingw compiler link and click on this link it will open download page for mingw gcc g plus compiler as you can see it is available for both windows 11 and windows 10 since we are using windows 11 so we will select the direct download link and now you can see ngw installer file is started downloading here it will take some time to download once the downloads get finished click on this up arrow and select show in folder now simply double click on this file here cancel all of this except c colon backslash and click on extract button and it will start the extraction and installation process it will take some time to complete now we need to add path in environment variable so that we can access gcc in cmd globally for that double click on this pc and open local disk c here open newly installed mingw directory then open bin folder and click on address bar and finally copy this path let me close all unnecessary windows now click on search button and type environment variables select edit the system environment variable option here click on environment variable button select path and then click on edit button and then click on new and paste mingw path in the blank field then click on ok button ok again and ok again good job now let's check is this working or not for that click on search button then type cmd and then click on command prompt here type gcc speaks dash dash version and press enter as you can see we have the latest gcc version installed here congratulations you have successfully installed mingw gcc compiler on your windows 11 machine correctly now i'll show you how you can download and install visual studio code on windows 11. you can skip this part if you already installed visual studio code and you can directly jump to c configuration part first of all copy this link i have provided this link in the video description and open up your favorite web browser i'm using google chrome here and then paste the copied link in the search bar and hit enter this is the official page for downloading visual studio code for all the operating systems now click on this blue download for windows button it says thanks for downloading vs code for windows and you can see our vs code installer file has started downloading here it's around 76 megabyte file at the time of recording once the downloads get finished click on this up arrow and then select show in folder we need to install this file simply double click on this file and it will start the setup wizard let me close all other windows so that we can focus on installation part here accept the license agreement and click on next button just leave it as a default for the destination folder just make sure you have at least 296 mb of free disk space available and click on next button no need to change anything here just click on next check create a desktop icon and don't forget to check add to path if it's not already checked click on next now it's ready to install visual studio code on your computer we can click on install button it will take some time to install it says completing the visual studio code setup wizard check this box to launch visual studio code and finally click on finish button this will automatically launch visual studio code for the very first time and it's all done here we have successfully installed visual studio code on windows 11 machine ok now let's configure visual studio code for running c program for that first we need to install c extension in visual studio code press this extension button and in the search bar type c c plus plus and select the first option make sure it is from microsoft it will install c debugging and code browsing support to install click on the small install button now in the search bar type code runner and choose the first option make sure it is from junhan now again press on this small install button to run the code you can press control plus alt plus n and to stop the code from running you can press ctrl plus alt plus m we can now close all of these windows now let's write some basic c program in the visual studio code for testing to create a new file in visual studio code you can click on file then select new file now again click on file and select save as choose your preferred directory i'm selecting desktop here give a name to your file i'm writing subscribe dot c just don't forget to add dot c at the end of the file for c program otherwise it won't work and then click on save button let me quickly type a basic c program that prints the message subscribe now you can copy this code from the same blog post i have already provided the link in the video description don't forget to save your program otherwise it gives an error now let's save the program for that click on file and select save or you can press ctrl s shortcut key to manually save the program if you want to enable the auto save feature in visual studio code then you can watch this video i have provided the link in the video description to run the program you can press ctrl alt plus n or you can simply click on this small play button and it works see subscribe now is printed here if you followed the steps in this video and reach until here i'm assuming this method has been working for you so i'm requesting you to please like the video and subscribe to my channel it won't cost you anything but it will definitely boost my morale for making more such videos okay now let's create another program which takes input from the user for that let's create a new file i'll name this file input program dot c then click on save okay here i'm writing the code for the program that asks the user for its first name and last name and finally prints the full name of the user back to the output console again you can copy this code from the same blog post i have already provided the link in the video description let's save the changes now run the code by pressing play button so our code is running but we are not able to input our first name here so this is a problem we can solve this problem by clicking on file then select preference then select settings type run in terminal here and go down a little bit and find code runner run in terminal and check this box now you can cancel the settings and return back to our program first click on stop button to terminate the execution of the previous program now run the code by pressing run play button let me type my first name here now the last name and now you can see my full name is printed here so this is how you can run c program in visual studio code on windows 11. if you are interested in learning more about c programming language then be sure to check out beginner c programming course in the video description subscribe and turn on the notifications so you don't miss more videos helping you to learn how to code and become a successful programmer and i'll see you in the next video take care
Info
Channel: Tech Decode Tutorials
Views: 145,504
Rating: undefined out of 5
Keywords: visual studio code, visual studio, vscode, visual studio code c, run c vscode windows 11, how to run c in visual studio code on windows 11, how to run c in vscode, mingw, Run C Code in windows 11 Visual Studio Code, c on windows 11, run c on windows 11, c compiler, visual studio code c windows 11, techdecode, input vscode, how to run c in visual studio code, run c in visual studio code, vscode c install, how to run c program in visual studio code, vs code, gcc, code editor for c
Id: eWSpJWRqxkw
Channel Id: undefined
Length: 11min 52sec (712 seconds)
Published: Mon Aug 22 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.