Testing Your C Programming Setup in VSCode
To confirm that your C programming environment is set up correctly in VSCode, follow these steps:
Steps to Test Your Setup
- Create a new folder and open it in VSCode:
- Go to File > Open Folder and select your folder.
- Create a new file named
hello.cwith the following code:
#include <stdio.h>
int main() {
printf("Hello, World!\n");
return 0;
}
- Run the code using one of these methods:
- Using Code Runner:
- If you have the "Code Runner" extension installed, click the Play button in the top-right corner of VSCode to run the code.
-
Using the Terminal:
- Open the terminal in VSCode (Ctrl+` or View > Terminal).
-
Compile the code by typing:
gcc hello.c -o hello -
Run the program:
-
On Linux/macOS, type:
./hello -
On Windows with MinGW, the executable might be
hello.exe, so type:./hello.exe
-
- Using Code Runner: