pointers and win programming
hi can someone please give me a good site explaining everything about pointers or explain so yourself. and do all programs require the 100 about lines for just setting up a window. im new to programming in windows and so far its pretty tough. im using windows game programming guru, can anyone recommend some good books to get started on. thanks
i am the best
I would suggest using MFC or OWL, or better yet C++ Builder. You will code a good deal less than with straight API calls. I really see little point in someone starting with straight API calls since MFC comes with about everything. Better to learn there and later move to straight API calls than to struggle with all the nit picking details straight out of the box.
Keys to success: Ability, ambition and opportunity.
A pointer is the same as any other var, except for a few special properties. It contains the address of an *actual variable, such as an int, or char, etc. So, if you printed the value of a pointer, it would look something like this: 0xA00b0800. That could point to any kind of variable. To create a pointer, you do this:
variable-type * pointer-name;
where variable-type is int or char, or void, or float, etc...
and pointer-name is any valid name, such as PointerToAnInt, etc...
To make the pointer point to something, do this:
int iSomeInt;
int * pInt;
pInt = &iSomeInt
iSomeInt is a regular integer variable.
pInt is a pointer to an int.
&iSomeInt returns the address of iSomeInt, so, if the address
of iSomeInt was 0x0Ab80000 then when you got to the point where
it says pInt = &iSomeInt, the computer would assign 0x0Ab80000 to pInt.
How do you do something with this? just use the *.
*pInt = 4;
No, that does not make pInt contain the address 0x00000004. instead, pInt points to iSomeInt. The star "de-references", changes the pointer into an int, ready to use, so *pInt changes pInt into iSomeInt. Get It? now, iSomeInt = 4;
play around with it some. I don''t know how much I helped, wrote this late at night, need some sleep. will probably return later, to add some more... have fun while i''m gone...
farmersckn
variable-type * pointer-name;
where variable-type is int or char, or void, or float, etc...
and pointer-name is any valid name, such as PointerToAnInt, etc...
To make the pointer point to something, do this:
int iSomeInt;
int * pInt;
pInt = &iSomeInt
iSomeInt is a regular integer variable.
pInt is a pointer to an int.
&iSomeInt returns the address of iSomeInt, so, if the address
of iSomeInt was 0x0Ab80000 then when you got to the point where
it says pInt = &iSomeInt, the computer would assign 0x0Ab80000 to pInt.
How do you do something with this? just use the *.
*pInt = 4;
No, that does not make pInt contain the address 0x00000004. instead, pInt points to iSomeInt. The star "de-references", changes the pointer into an int, ready to use, so *pInt changes pInt into iSomeInt. Get It? now, iSomeInt = 4;
play around with it some. I don''t know how much I helped, wrote this late at night, need some sleep. will probably return later, to add some more... have fun while i''m gone...
farmersckn
Yesterday is the past, tomorrow is the future. Today is a gift, that is why we call it the present.
I started straight out of the box with the API. I think MFC is cluttered and although it lets you use some of the high level features of windows, I think its better to get down and dirty first. This way you only have to look up and figure out what you need to get to where you want to be, rather than trying to peer down through the murk of Win32 and trying to decipher whats going on. I just got Programming Windows 95 by Charles Petzold for $4 in January and have been reading it (slowly) since then. Its a boring ass read, but very in depth and I really feel I have a solid handle on what I''m doing. I have a few really important chapters to go, such as the File Edit menu''s etc, but I have all the GDI, keyboard, and mouse stuff down pat.
There is no spoon.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement