|
|
Mike Raiford <"m[raiford]!at"@gmail.com> wrote:
> I remember declaring structs in C being rather weird.
The problem with C structs is that whenever you want to use them, you
have to say so. In other words, this works in C++, but not in C:
struct Foo { whatever; };
void bar()
{
Foo foo; // Doesn't work in C
}
Instead, you have to write:
struct Foo foo; // Works in both C++ and C
However, there's a workaround in C (which also works in C++, because of
the backwards compatiblity):
typedef struct { whatever; } Foo;
Now you can use "Foo" without having to put the "struct" before it every
time.
--
- Warp
Post a reply to this message
|
|