Re: sizeof a union



On Tue, 29 Nov 2005 23:10:34 +0800, in comp.lang.c , "Mockey Chen"
<mockey.chen@xxxxxxxxxx> wrote:

>My friend ask me a question as following:

of the size of a union or struct

>My compiler tell me the answer is 6.
>I want to know why the answer is 6.

This is a FAQ.
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt>

----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
.



Relevant Pages

  • Re: Converting Little Endian to big endian
    ... > struct raw_data ... > unsigned char x; ... > interpreted in 4 integers inside the union. ... the compiler is likely to generate code ...
    (comp.lang.c)
  • Re: Error from unnamed struct in Solaris CC compiler
    ... C/C++ to Solaris 10. ... But the CC compiler ... The error is due to the fact that the struct inside the above union is ...
    (comp.unix.programmer)
  • Re: Unions in structures
    ... Is this specific to the compiler, ... A union does not need to have a union tag, and a struct ...
    (comp.lang.c)
  • Re: A doubly linked-list in C
    ... least not without tucking the array inside a struct or union. ... If a compiler detects that it's safe to do so, ...
    (comp.lang.c)
  • Re: offset macro for bit fields
    ... struct speed_part ... unsigned int left_wheel:4; ... It is not a good idea to combine these into a union. ... the association can change between compiler on the same platform, ...
    (comp.lang.c)