How to write C language with VS2022 (beginner)

Why use VS2022 to write C language

The full name of vs2022 is visual studio 2022, which is a new development and programming production tool produced by Microsoft. To put it simply, VS2022 is an IDE (Integrated Development Environment). For beginners like us, it is not recommended to toss the development environment by ourselves, so we can use VS2022 directly to get it right in one step, saving a lot of trouble. Otherwise, if you toss the development environment by yourself, it is easy to go from getting started to giving up.

Download of vs2022

Official website link
insert image description here
Select the community version.

How to use VS2022 to create a C language program

Check if the environment is complete

insert image description here
First open Visual Studio Installerthe software and click Modify.
insert image description here
Make sure that these two options have been installed, select them if they are not installed, and then click the modify option in the lower right corner, and wait for the installation to complete.

Create a .C source file

After we have installed VS2022, we can find the following two icons:
insert image description here
we can choose to open the software pointed by the red arrow.
The interface just opened is as follows
insert image description here
Click to create a new project.
insert image description here
insert image description here
insert image description here
insert image description here
insert image description here

test program

We write a test code:

#include <stdio.h>
int main()
{
    
    
	printf("Hello World!\n");
	return 0;
}

insert image description here
insert image description here
It's ok to see this result!

Precautions:

1. Use of scanf function

VS does not support the scanf function. To use this function, we need to perform the following steps:
1. Use file search software (such as Everything , the hyperlink is a download link, you can directly download the installation package) to find newc++file.cppfiles.
2. insert image description here
3. Copy the file to the desktop
4. Use Notepad to open the copied version of the file on the desktop.
5. Add the following paragraph

#define _CRT_SECURE_NO_WARNINGS 1

insert image description here
6. Save and launch, and then replace the original file.
insert image description here
This is done, and we can see that there is no error when the scanf function is used again!
insert image description here

2. Adjust the theme and font

The last point, teach you how to personalize your own VS2022.
insert image description here
Modify theme:
insert image description here
Modify font:
insert image description here

Summarize

VS2022 is a friendly IDE for novices, one step in place, although the software may be a little big, but its function is very powerful, we need to experience it slowly in the future!
I wrote a novice tutorial, mainly to teach you how to use VS2022. If you have any questions, I hope you can discuss them in the comment area and make progress together!
insert image description here

Guess you like

Origin blog.csdn.net/m0_72482689/article/details/126166805