Click here to Skip to main content
15,912,329 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Why Pointers? Pin
8-May-02 22:36
suss8-May-02 22:36 
AnswerRe: Why Pointers? Pin
Philip Patrick8-May-02 1:34
professionalPhilip Patrick8-May-02 1:34 
AnswerRe: Why Pointers? Pin
Andrew Peace8-May-02 1:56
Andrew Peace8-May-02 1:56 
AnswerRe: Why Pointers? Pin
LittleYellowBird8-May-02 2:17
LittleYellowBird8-May-02 2:17 
AnswerRe: Why Pointers? Pin
Joaquín M López Muñoz8-May-02 3:07
Joaquín M López Muñoz8-May-02 3:07 
GeneralRe: Why Pointers? Pin
a.a8-May-02 3:27
a.a8-May-02 3:27 
AnswerRe: Why Pointers? Pin
Nish Nishant8-May-02 3:57
sitebuilderNish Nishant8-May-02 3:57 
AnswerRe: Why Pointers? [Just memory! ] Pin
Maxwell Chen8-May-02 8:45
Maxwell Chen8-May-02 8:45 
Some people call C++ the mid-level language. What does "mid-level" mean? Not as high level as Java or VB is (everything you need is just out there: Java has Virtual Machine, and the VB development tool does a lot of things for programmers. ); and not as low level as assembly language is (push, mov, eax, ..... ).

As sort of mid-level language, C++ covers both features of high and low ones. C++ is a structured language and uses 47 ( +1 : 'typename' ) English keywords, and the syntax is close to a certain human speach (if... else. do... while. try...throw... catch... ).

Then, what feature C++ covers as low-level one? Direct access to memory! How? With the feature of pointers, we can.

For example, if you want to set some desired value to somewhere in the memory, we may use:

int* p = (int*)0x0FCC00;
*p = 123456;


Or you can view where the variable is, you can code such:

double dMyMagicNum = 3.1415926535897932384626433832795;
printf("dMyMagicNum is at 0x%p \n", &dMyMagicNum);


There is also a trick called "Placement memory allocation".
If you had allocated some memory in the free store:

char* buf = new char[sizeof(int) * 300];
int* p = new(buf + 6) int; // To dig some memory from the memory you've already allocated.
printf("Buf: 0x%p, p: 0x%p\n", buf, p);





Maxwell Chen
People say "No news is good news". Then, no code is good code!?
QuestionEasiest way to display colored text in a textbox? Pin
generic_user_id8-May-02 0:45
generic_user_id8-May-02 0:45 
AnswerRe: Easiest way to display colored text in a textbox? Pin
Nish Nishant8-May-02 4:05
sitebuilderNish Nishant8-May-02 4:05 
AnswerRe: Easiest way to display colored text in a textbox? Pin
Chris Losinger8-May-02 4:19
professionalChris Losinger8-May-02 4:19 
AnswerRe: Easiest way to display colored text in a textbox? Pin
Marc Richarme8-May-02 8:33
Marc Richarme8-May-02 8:33 
GeneralRe: Easiest way to display colored text in a textbox? Pin
generic_user_id8-May-02 23:19
generic_user_id8-May-02 23:19 
GeneralKill exe's... ( processes) Pin
Braulio Dez8-May-02 0:12
Braulio Dez8-May-02 0:12 
GeneralRe: Kill exe's... ( processes) Pin
adara8-May-02 1:43
adara8-May-02 1:43 
GeneralRe: Kill exe's... ( processes) Pin
Braulio Dez8-May-02 2:47
Braulio Dez8-May-02 2:47 
GeneralRe: Kill exe's... ( processes) Pin
adara8-May-02 4:24
adara8-May-02 4:24 
GeneralRe: Kill exe's... ( processes) Pin
Nish Nishant8-May-02 4:08
sitebuilderNish Nishant8-May-02 4:08 
GeneralRe: Kill exe's... ( processes) Pin
Braulio Dez8-May-02 4:19
Braulio Dez8-May-02 4:19 
GeneralRe: Kill exe's... ( processes) Pin
Chris Losinger8-May-02 4:20
professionalChris Losinger8-May-02 4:20 
GeneralRe: Kill exe's... ( processes) Pin
Braulio Dez8-May-02 4:25
Braulio Dez8-May-02 4:25 
GeneralRe: Kill exe's... ( processes) Pin
Mike Nordell9-May-02 21:20
Mike Nordell9-May-02 21:20 
GeneralRe: Kill exe's... ( processes) Pin
Braulio Dez10-May-02 3:08
Braulio Dez10-May-02 3:08 
Generalslightly puzzled... Pin
l a u r e n7-May-02 23:42
l a u r e n7-May-02 23:42 
GeneralRe: slightly puzzled... Pin
Henk Groenewoud8-May-02 0:59
Henk Groenewoud8-May-02 0:59 

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.