Try to write something, mainly to consolidate what you have learned.
The structure of the body? The structure of C language is mainly used to express, define some of the types you want, such as date, identity information and so on.
Date: 2017-09-10
Identity information: Name Fakke, age 23, height 180;
Can be implemented through structs. (Personal feeling a bit like a python dictionary)
Define the way:
First step: Declare the struct type:
struct type name {
Variable type 1 variable name;
Variable type 2 variable name;
。。。
Variable type 3 variable name;
};
Step Two:
2 Defining a new variable
struct date variable name;
Step Three:
Variable Assignment initial value
struct Date today = {07,12,2017};
struct Date today = {. month=01,.year=2012};
Two assignment methods, no default 0 specified, such as an array.
There are two ways to declare data types, of course.
One is:
struct {
}P1,P2;
P1,P2 is the two variable of this nameless type, which you might just need to use, without having to declare a data type.
The other is:
struct Point {
}P1,P2;
This method of declaring the data type, while doing two things, one is declaring one type, and the other is creating two variables.
C language----Structure--declaration and definition