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 realize a Union in C language

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

Share

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

This article mainly introduces the relevant knowledge of "how to realize a consortium in C language". The editor shows you the operation process through an actual case, and the operation method is simple, fast and practical. I hope this article "how to implement a consortium in C language" can help you solve the problem.

1. Definition:

Union (int I, short s, char c) un; un.i = 3; printf ("I% d", un.i); printf ("length =% d\ n", sizeof (un); / / = = 4, there is the largest variable to determine

two。 It is equivalent to the List T type in java.

3. Data exchanging

Void swap (int * p, int * Q) {int temp = * p; * p = * Q; * Q = temp;}

4. Print address

Int I = 2; printf ("% # x", & I)

5. Pointer prints array values

Int arr [] = {1Pert 2je 3je 4}; int * p = & arr; prinft ("% d\ n", * (pendant 0)); prinft ("% d\ n", * (pendant 1)). That's all for "how to implement a consortium in C language". Thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.

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