In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
The structure sounds professional, hard and unfriendly. To put it another way, it is actually a "plane ticket". Yes, the format of "plane ticket".
Well, the general way of writing goes like this:
Struct Ticket {(the type of "ticket" is capitalized)
Char name [20] (passenger name)
Char airline [10] (flight)
Int takeoff (departure time)
Int arrive (time of arrival)
(there is also some messy information, slightly)
} passenger1,passenger2; ("passenger 1, passenger 2" variable name is specified in all lowercase. Pay attention to semicolon)
Then, enter the corresponding name for "passenger 1, passenger 2" and so on, and you can use it. You can continue to add new passengers and then issue the ticket. If it is followed by more variable names, you don't have to define it immediately after the "}" of struct, such as another line like this:
Struct Ticket passenger1,passenger2
The above two are the most commonly used ways of writing. Forget the other expressions. Only those who have enough to eat and support will remember them.
What do you do if you want to get the "arrival time" of passenger 1? "passenger1.arrive", just like taking attributes in VB, is professionally called "reference". How to initialize all the passenger information? "passenger1= {" Lining "," MF3678 ", 1600 1900};".
A structural array is a strategy for dealing with many "passengers". 20 passengers write "passenger [20]", and passenger [1] is the equivalent of "passenger 1". Obviously, the "passenger [1]" contains all the information that should be on the "air ticket". With the abstraction of arrays, you don't have to define struct variables one by one.
Structure pointer, which treats the structure as a variable type and operates according to the pointer variable. I'm not used to it at first, but when I get familiar with it, I turn around. Or take "air tickets" as an example:
Struct Ticket passenger1; (declare structure variables)
Struct Ticket * point; (declare the structure pointer variable point)
Point=&passenger1; (take passenger1 address)
Then there are the following equivalent forms:
Passenger1.name = (* point). Name = point- > name (the last "- >" is called the "pointing operator" and is exclusive to pointer variables!)
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.