Advertisement

Windows programming weirdness

Started by August 07, 2000 11:47 PM
2 comments, last by Sponge99 24 years, 4 months ago
Simple question: How come, in DDraw, when I declare this:

LPDIRECTDRAW lpDD;

It makes lpDD a pointer?! What gives? Am I overlooking a special C programming feature (because of my lack of, uh, experience) or is "Windows Weirdness"? Dare wa neko o koroshiteimasuka? (Ha! Learn Nihongo!)
"Now watch as I run away in a womanly fashion." - Batman
LPDIRECTDRAW is a typedef for DIRECTDRAW*
Advertisement
No, that''s just the way it''s declared.

You can say this:

typedef struct {
int x, y, z;
} MYSTRUCT, *LPMYSTRUCT;

Then you can declare a structure like this:

MYSTRUCT MyStruct;

And a Pointer to a MYSTRUCT like this:

LPMYSTRUCT lpMyStruct; // same as MYSTRUCT* lpMyStruct;

Hope that helps..
// CHRIS
// CHRIS [win32mfc]
Yeah, that helped. I always wondered why you would use typedef''s instead of just declaring a struct. Maybe that''s not the singular reason, but I understand now.

Thanks!

Dare wa neko o koroshiteimasuka? (Ha! Learn Nihongo!)
"Now watch as I run away in a womanly fashion." - Batman

This topic is closed to new replies.

Advertisement