Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to assign the structure in C language

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report