|
From: <de...@ci...> - 2004-01-31 21:59:02
|
In the first form you have two different types, and you can use either.
For instance
struct _Human fred;
Human joe;
Note that it is simply to avoid always having to refer to struct _Human
that the typedef is used. This is traditional C usage.
In C++ on the other hand the second form is used, and the type is Human,
not struct Human.
So you can use
Human joe;
C++ compilers will compile the first form too, but the resulting types
will be _Human and Human unless there is an extern "C" block surrounding
the declaration.
In article <BAY...@ho...>,
coo...@ho... (Noorez Kassam) wrote:
> what is the difference between these two
>
> typedef struct _Human
> {
> int height;
> }Human;
>
> struct Human
> {
> int height;
> };
>
>
> and in the first one, what does 'Human' mean at the end? In both
> structs u can declare a Human type, even without the Human thing at the
> end in the first one
|