Accessing array elements within a structure

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • David Thompson

    #16
    Re: Accessing array elements within a structure

    On Mon, 16 Jun 2008 10:06:19 -0700, Keith Thompson <kst-u@mib.org>
    wrote:
    <snip correct and nicely explained diagnosis>
    Here's how to print those values:
    >
    printf("type %ld - file size %lu:\n",
    example.type,
    (unsigned long)example.fi les[0]);
    >
    That's for C90, and it also works in C99 (as long as the value of
    example.files[0] doesn't happen to exceed ULLONG_MAX). Note that the
    (IQC)YM ULONG_MAX.
    cast is necessary to ensure that the types match exactly (this is one
    of the rare cases where a cast is necesssary and appropriate).
    >
    <snip rest>
    - formerly david.thompson1 || achar(64) || worldnet.att.ne t

    Comment

    Working...