In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
Most people do not understand the knowledge points of this article "how to define common body variables in c language", so the editor summarizes the following content, detailed content, clear steps, and has a certain reference value. I hope you can get something after reading this article, let's take a look at this article "how to define common body variables in c language".
Common volume variables can be defined in the following three forms.
1. Define the common body type first and then define the common volume variable
Union data
{
Short a
Int b
Double c
}
Union data u1, u2
two。 Define common volume variables while defining the common body type
Union data
{
Short a
Int b
Double c
} u1,u2
3. Define common volume variables directly
Union
{
Short a
Int b
Double c
} u1,u2
Above, the common volume variables U1 and U2 are defined in three forms, and the following variable U1 is taken as an example to analyze the memory space allocation of the common volume variables. Suppose that in the C language education compiler used, the short type occupies 2 bytes, the int type takes 4 bytes, and the double type takes 8 bytes. You can see that the member c occupies the largest memory space, and the system allocates 8 bytes of memory space for the variable U1 as shown in the figure.
As you can see from the figure, although the common body and the structure are very similar in the defined grammatical form, their memory allocation is completely different from the structure, and only one member's data can be stored in the memory space at any time, that is, only one member of a common body variable can be used at any time in the program.
The above is the content of this article on "how to define common body variables in c language". I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please follow the industry information channel.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.