Click here to Skip to main content
15,903,388 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionswap Red and Blue in GDI+ Pin
ilidan25-May-06 18:45
ilidan25-May-06 18:45 
AnswerRe: swap Red and Blue in GDI+ Pin
_anil_25-May-06 19:37
_anil_25-May-06 19:37 
GeneralRe: swap Red and Blue in GDI+ Pin
ilidan25-May-06 19:50
ilidan25-May-06 19:50 
GeneralRe: swap Red and Blue in GDI+ Pin
_anil_25-May-06 20:01
_anil_25-May-06 20:01 
GeneralRe: swap Red and Blue in GDI+ Pin
ilidan25-May-06 20:14
ilidan25-May-06 20:14 
Questionpointer [modified] Pin
jith - iii25-May-06 18:45
jith - iii25-May-06 18:45 
AnswerRe: pointer Pin
PJ Arends25-May-06 18:59
professionalPJ Arends25-May-06 18:59 
AnswerRe: pointer Pin
S. Senthil Kumar25-May-06 19:04
S. Senthil Kumar25-May-06 19:04 
It's all pretty simple, once you get the hang of it.

When you declare a pointer, the compiler allocates a certain number of bytes (depending on the platform) on the stack. The size of the pointer is derived from the maximum address space that it can point to. In a 32 bit environment running Windows, each process gets 4GB of address space, so a pointer must be big enough to point at any address from 0 to 0xFFFFFFFF. The size of the pointer is therefore log2(4294967296), which is equal to 32 bits. You can do the same calculation for a 64 bit environment.

This memory allocated by the compiler holds the address of whatever the pointer is pointing to, at runtime.
jithAtran - ii wrote:
*p=2; // integer 2 is stored in 1000 and 1001 as(0000 0010)

I don't get what 1000 and 1001 are. If you consider them to be address of the pointer itself (&p), then your comment is incorrect. If you consider them to be the address where the pointer is pointing at, then your interpretation is correct. I'll assume you meant the latter.
jithAtran - ii wrote:
p=&j; // now doubt,here how 1000,1001 store the address of j

All this does is change where p is pointing at. p will no longer hold 1000/1001, instead, it will hold whatever is the address of j (2000, 2001, for example). That explains why *p and j hold the same value.


Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
GeneralRe: pointer Pin
jith - iii25-May-06 19:22
jith - iii25-May-06 19:22 
GeneralRe: pointer Pin
S. Senthil Kumar25-May-06 19:52
S. Senthil Kumar25-May-06 19:52 
GeneralRe: pointer [modified] Pin
jith - iii25-May-06 21:09
jith - iii25-May-06 21:09 
GeneralRe: pointer Pin
S. Senthil Kumar25-May-06 22:59
S. Senthil Kumar25-May-06 22:59 
GeneralRe: pointer [modified] Pin
jith - iii25-May-06 23:31
jith - iii25-May-06 23:31 
GeneralRe: pointer [modified] Pin
S. Senthil Kumar26-May-06 14:27
S. Senthil Kumar26-May-06 14:27 
GeneralRe: pointer [modified] Pin
jith - iii26-May-06 19:02
jith - iii26-May-06 19:02 
GeneralRe: pointer [modified] Pin
S. Senthil Kumar26-May-06 20:42
S. Senthil Kumar26-May-06 20:42 
GeneralRe: pointer [modified] Pin
jith - iii26-May-06 22:30
jith - iii26-May-06 22:30 
GeneralRe: pointer [modified] Pin
Stephen Hewitt26-May-06 18:05
Stephen Hewitt26-May-06 18:05 
GeneralRe: pointer [modified] Pin
S. Senthil Kumar26-May-06 20:35
S. Senthil Kumar26-May-06 20:35 
AnswerRe: pointer [modified] Pin
Member 303984325-May-06 19:29
Member 303984325-May-06 19:29 
AnswerRe: pointer [modified] Pin
Saday Sarkar25-May-06 19:51
Saday Sarkar25-May-06 19:51 
GeneralRe: pointer [modified] Pin
jith - iii25-May-06 21:11
jith - iii25-May-06 21:11 
GeneralRe: pointer [modified] Pin
Stephen Hewitt26-May-06 18:25
Stephen Hewitt26-May-06 18:25 
GeneralRe: pointer [modified] Pin
jith - iii26-May-06 19:06
jith - iii26-May-06 19:06 
QuestionLinux's gettimeofday() equivalent for windows Pin
useme12325-May-06 18:41
useme12325-May-06 18:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.