Visual Studio Code is an IDE that allows programmer to create many types of programming language, c, c++, c sharp and many more. In this post I am going to show you how to create a c program, compile and then run it in visual studio code. Follow the below steps…
1) Create an empty c program file
2) Write the below c program which will find out the square root of 9 in vs code editor.
#include <stdio.h> #include <math.h> int main(void) { double x = sqrt(9); printf("The sqrt of 9 is %f\n", x); return 0; }
3) Open the new terminal, Terminal–>New Terminal and type in below line of command to compile the above c program.
gcc example.c -o example
4) Now run the c program
./example
which will show below outcome