Click here to Skip to main content
15,898,371 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generalot Pin
porta_01011-May-10 6:00
porta_01011-May-10 6:00 
GeneralRe: ot Pin
jeron111-May-10 6:16
jeron111-May-10 6:16 
JokeRe: ot Pin
Code-o-mat11-May-10 6:22
Code-o-mat11-May-10 6:22 
JokeRe: ot Pin
«_Superman_»11-May-10 7:16
professional«_Superman_»11-May-10 7:16 
RantRe: ot Pin
Code-o-mat11-May-10 9:11
Code-o-mat11-May-10 9:11 
GeneralRe: ot Pin
loyal ginger11-May-10 8:49
loyal ginger11-May-10 8:49 
Questiona question of struct copys Pin
wbgxx11-May-10 5:37
wbgxx11-May-10 5:37 
AnswerRe: a question of struct copys Pin
Code-o-mat11-May-10 6:10
Code-o-mat11-May-10 6:10 
wbgxx wrote:
char c = 'a';
-here you make c equal to 'a'

wbgxx wrote:
instant1.cMember = &c;
-here you make the cMember pointer of instant1 point at the variable c, so instant1.cMember now contains the memory location of c

wbgxx wrote:
instant2 = instant1;
-here you copy the contents of instant1 into instant2, so the members in instant2 (iMember, cMember) will contain the same values as the corresponding ones in instant1. This means, instant2.cMember now also points at your c variable, both instant1.cMember and instant2.cMember contains the memory address of the variable c.

wbgxx wrote:
cout << *(instant1.cMember) << endl;
-here you say "print out the value that is stored in the memory location pointed at by instant1.cMember", this memory location happens to be c's, and since you set c to 'a', it will print 'a'.

wbgxx wrote:
*(instant2.cMember) = 'b';
- here you say, "copy the value 'b' to the memory location pointed at by instant2.cMember", which is -as you remember- the same as instant1.cMember, the address of your c variable.

wbgxx wrote:
cout << *(instant1.cMember) << endl;
- here you say now, "print out the value that is stored in the memory location pointed at by instant1.cMember" again, but since this memory location is the same as the one stored in instant2, and previously you changed the value stored in that memory location to 'b', it will print 'b'.

This is basic pointer stuff, i recommend reading some good books or checking out online tutorials about pointers in C/C++...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <

AnswerRe: a question of struct copys Pin
«_Superman_»11-May-10 7:15
professional«_Superman_»11-May-10 7:15 
AnswerRe: a question of struct copys Pin
Luc Pattyn11-May-10 8:06
sitebuilderLuc Pattyn11-May-10 8:06 
Questioncould some one give me a detail of this the result??I don not know why,more detail more better Pin
wbgxx11-May-10 5:23
wbgxx11-May-10 5:23 
AnswerRe: could some one give me a detail of this the result??I don not know why,more detail more better Pin
Code-o-mat11-May-10 5:54
Code-o-mat11-May-10 5:54 
AnswerRe: could some one give me a detail of this the result??I don not know why,more detail more better Pin
«_Superman_»11-May-10 7:30
professional«_Superman_»11-May-10 7:30 
AnswerRe: could some one give me a detail of this the result??I don not know why,more detail more better Pin
wbgxx11-May-10 12:42
wbgxx11-May-10 12:42 
GeneralRe: could some one give me a detail of this the result??I don not know why,more detail more better Pin
Iain Clarke, Warrior Programmer11-May-10 23:00
Iain Clarke, Warrior Programmer11-May-10 23:00 
QuestionTooltip Flashing Pin
Steve Thresher11-May-10 4:48
Steve Thresher11-May-10 4:48 
AnswerRe: Tooltip Flashing Pin
Code-o-mat11-May-10 5:38
Code-o-mat11-May-10 5:38 
QuestionHow to force an 'Alt' key stroke without keyboard? (MFC) [modified] Pin
Software200711-May-10 4:22
Software200711-May-10 4:22 
AnswerRe: How to force an 'Alt' key stroke without keyboard? (MFC) [modified] Pin
Code-o-mat11-May-10 5:34
Code-o-mat11-May-10 5:34 
GeneralRe: How to force an 'Alt' key stroke without keyboard? (MFC) Pin
Software200711-May-10 5:52
Software200711-May-10 5:52 
GeneralRe: How to force an 'Alt' key stroke without keyboard? (MFC) Pin
Code-o-mat11-May-10 5:56
Code-o-mat11-May-10 5:56 
QuestionMy progremmer can't run,why?? Pin
wbgxx11-May-10 4:17
wbgxx11-May-10 4:17 
AnswerRe: My progremmer can't run,why?? Pin
Cedric Moonen11-May-10 4:18
Cedric Moonen11-May-10 4:18 
GeneralRe: My progremmer can't run,why?? Pin
wbgxx11-May-10 4:27
wbgxx11-May-10 4:27 
GeneralRe: My progremmer can't run,why?? PinPopular
Cedric Moonen11-May-10 4:33
Cedric Moonen11-May-10 4:33 

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.