Click here to Skip to main content
15,913,669 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Icon of an executable file Pin
Blake V. Miller8-Jul-05 16:44
Blake V. Miller8-Jul-05 16:44 
GeneralVC7, PROPVARIANT, #import Pin
peterchen8-Jul-05 4:41
peterchen8-Jul-05 4:41 
GeneralMultithreaded Client Pin
vadimpl8-Jul-05 4:32
vadimpl8-Jul-05 4:32 
GeneralRe: Multithreaded Client Pin
Ravi Bhavnani8-Jul-05 11:43
professionalRavi Bhavnani8-Jul-05 11:43 
GeneralDouble pointers question Pin
Budric B.8-Jul-05 4:06
Budric B.8-Jul-05 4:06 
GeneralRe: Double pointers question Pin
David Crow8-Jul-05 5:37
David Crow8-Jul-05 5:37 
GeneralRe: Double pointers question Pin
John R. Shaw8-Jul-05 10:13
John R. Shaw8-Jul-05 10:13 
GeneralRe: Double pointers question Pin
Toby Opferman8-Jul-05 10:31
Toby Opferman8-Jul-05 10:31 
So, what is the difference between ** and [x][y]? Well, one is a static memory location and the other are pointers.

float **x;
float y[10][3];


x is a pointer to a pointer. So, what the compiler does it it goes to the address of the variable X. It then reads this address and then goes to the address stored at that location. It then uses this address as the place to store the float!

If you understand single pointers you can see how the double pointer works:
First Address = *x;
Second Address = *First Address;
The Actual Float Value = *Second Address;


At any level you can actually allocate a "block" of pointers that you can index into at that time.


So what's the difference with an array?

    y[1][2] = 12;

Is actually

    y[3 + 2] = 12;


It's a single block of memory! There are no pointers! In the case of even a single float *, the address of the variable stores the address that then stores the actual value! In the case of an array, the address of the variable stores the actual value!

So, a multi-dimentional pointer is actually a single block of memory that is then index by the compiler as one block. So if you have: rows by columns:
float x[row][column]

each row is maxcolumns size. So if you want to go to rowx, coly, you could simply do rowx*maxcolumns + coly. This would index that block of memory.

The compiler knows how to generate the correct code if it's an array or pointer. Remember, an array's address stores the actual data. The pointer's address, stores another address. That address then stores the data (in a single indirection case).





8bc7c0ec02c0e404c0cc0680f7018827ebee
GeneralDisplaying MFC dialog Pin
cdm5z8-Jul-05 3:39
cdm5z8-Jul-05 3:39 
GeneralRe: Displaying MFC dialog Pin
Manfred Staiger8-Jul-05 3:55
Manfred Staiger8-Jul-05 3:55 
GeneralRe: Displaying MFC dialog Pin
cdm5z8-Jul-05 4:03
cdm5z8-Jul-05 4:03 
GeneralRe: Displaying MFC dialog Pin
Manfred Staiger8-Jul-05 4:19
Manfred Staiger8-Jul-05 4:19 
GeneralCWnd::Create -> program terminates immediately after window creation Pin
awah8-Jul-05 3:39
awah8-Jul-05 3:39 
GeneralRe: CWnd::Create -> program terminates immediately after window creation Pin
David Crow8-Jul-05 4:23
David Crow8-Jul-05 4:23 
GeneralRe: CWnd::Create -> program terminates immediately after window creation Pin
Alexander M.,8-Jul-05 7:12
Alexander M.,8-Jul-05 7:12 
GeneralRe: CWnd::Create -> program terminates immediately after window creation Pin
ThatsAlok8-Jul-05 20:31
ThatsAlok8-Jul-05 20:31 
QuestionHow to capure mouse move with child window overlapping ? Pin
ldaoust8-Jul-05 3:17
ldaoust8-Jul-05 3:17 
AnswerRe: How to capure mouse move with child window overlapping ? Pin
Manfred Staiger8-Jul-05 3:38
Manfred Staiger8-Jul-05 3:38 
GeneralRe: How to capure mouse move with child window overlapping ? Pin
ldaoust8-Jul-05 4:07
ldaoust8-Jul-05 4:07 
GeneralRe: How to capure mouse move with child window overlapping ? Pin
Manfred Staiger8-Jul-05 4:29
Manfred Staiger8-Jul-05 4:29 
GeneralRe: How to capure mouse move with child window overlapping ? Pin
ldaoust8-Jul-05 6:09
ldaoust8-Jul-05 6:09 
GeneralRe: How to capure mouse move with child window overlapping ? Pin
ldaoust8-Jul-05 6:32
ldaoust8-Jul-05 6:32 
AnswerRe: How to capure mouse move with child window overlapping ? Pin
John R. Shaw8-Jul-05 17:30
John R. Shaw8-Jul-05 17:30 
QuestionUsing a "windows file manager"-like control? Pin
Salvador Dali8-Jul-05 2:12
Salvador Dali8-Jul-05 2:12 
AnswerRe: Using a "windows file manager"-like control? Pin
David Crow8-Jul-05 3:35
David Crow8-Jul-05 3:35 

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.