C Programming question ...
Kevin O'Gorman
kogorman at gmail.com
Wed Jan 7 08:55:46 PST 2009
On Wed, Jan 7, 2009 at 8:00 AM, Ben Duncan <bend at linux4ms.net> wrote:
> On this example:
>
> struct is_field {
> int f_type;
> int f_size;
> int f_offset;
> char f_name[MAXFIELDNAME];
> };
> typedef struct is_field field_t;
>
>
> Is the "typedef item field_t" being allocated or just declared?
>
> I know if I do a :
>
> struct is_field {
> ...... } My_Struct
>
> then My_Struct is allocated
>
>
> Thanks ...
The typedef does not declare a thing, but a type. You can then use the type
to declare (and possibly allocate) things. In this case, the new type
is field_t.
So you can use it in a declarations
field_t fieldThing;
Which I woruld prefer to the awkward alternative
struct is_field otherThing;
HTH
++ kevin
>
> --
> Ben Duncan - Business Network Solutions, Inc. 336 Elton Road Jackson MS,
> 39212
> "Never attribute to malice, that which can be adequately explained by
> stupidity"
> - Hanlon's Razor
>
> _______________________________________________
> Linux-users mailing list ( Linux-users at linux-sxs.org )
> Unsub/Password/Etc: http://linux-sxs.org/mailman/listinfo/linux-users
>
> Need to chat further on this subject? Check out #linux-users on
> irc.linux-sxs.org !
>
--
Kevin O'Gorman, PhD
More information about the Linux-users
mailing list