How to assign the structure in C language
This article mainly explains "how C language assigns the structure". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought. Let's study and learn "how C language assigns structures".
Assign values to members.
For example, structure struct st1 {
Int a
Int b
Int c
}
1.1 in {} form.
Struct st1 st1 = {1pm 2pm 3)
1.2 linux kernel style.
Struct st1 st1 = {
.a = 1
B = 2
}
/ / Note this style (that is, adding a dot ".") before the member variables, you can assign values out of the order of the member variables. If it can be
Struct st1 st1 = {
C = 3
.a = 1
B = 2
}
2 assign a value to the whole.
Struct st1 a, b
B = a
Thank you for your reading. the above is the content of "how C language assigns structures". After the study of this article, I believe you have a deeper understanding of the problem of how C language assigns values to structures. the specific use also needs to be verified by practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!