Click here to Skip to main content
14,426,390 members

Managed C++/CLI

 
AnswerRe: How to swap address of pointers of 2 variables without using a temporary variable? Pin
zhijzan7-Jun-15 21:40
Memberzhijzan7-Jun-15 21:40 
AnswerRe: How to swap address of pointers of 2 variables without using a temporary variable? Pin
Shao Voon Wong28-Jun-15 23:13
mvaShao Voon Wong28-Jun-15 23:13 
Questionhow to migrate CORBA to Web Service in C++ Pin
VC_RYK13-Apr-15 21:20
MemberVC_RYK13-Apr-15 21:20 
Questionconsumer.C: In function âint main(int, char**)â: consumer.C:69: error: invalid conversion from âvoid (*)(buffer_t*, char)â to âvoid* (*)(void*)â consumer.C:69: error: initializing argument 3 of âint pthread_create(pthread_t*, const pthread_attr_t*, Pin
Member 1160464113-Apr-15 16:29
MemberMember 1160464113-Apr-15 16:29 
AnswerRe: consumer.C: In function âint main(int, char**)â: consumer.C:69: error: invalid conversion from âvoid (*)(buffer_t*, char)â to âvoid* (*)(void*)â consumer.C:69: error: initializing argument 3 of âint pthread_create(pthread_t*, const pthread_attr Pin
Richard MacCutchan13-Apr-15 22:33
communityengineerRichard MacCutchan13-Apr-15 22:33 
Questionint **p = (int**)new int(5); Confusing !!! Pin
Amrit Agr5-Apr-15 9:32
MemberAmrit Agr5-Apr-15 9:32 
AnswerRe: int **p = (int**)new int(5); Confusing !!! Pin
Richard Andrew x645-Apr-15 11:14
professionalRichard Andrew x645-Apr-15 11:14 
AnswerRe: int **p = (int**)new int(5); Confusing !!! Pin
Zabir Al Nazi Nabil5-Apr-15 12:34
professionalZabir Al Nazi Nabil5-Apr-15 12:34 
here, p is a pointer to int*.that means p can point to an int pointer and that pointer will point an int type of data.
when you do this , (int**) new int (5) ; you are actually forcing (casting) p to point to an int pointer (memory address) with value 5 ..(It actually should not be done because you don't know anything about memory address 0x5 )... however and as you made p to store something(a memory address with value 5) you also allocated memory for that purpose ......

and the typecasting was necessary as first case is very different than the second case....
in the second case --- ap is an int pointer and with new command you allocated 4 bytes of memory for ap .. and ap is now pointing to that memory location and as you passed 20 in the constructor so now that memory address is storing 20....
But, p is not an int pointer ..it's a pointer to int pointer ...so it should be passed a valid memory address in the constructor call .. not an int(what you did -- by passing 5)..that's why you had to cast...
and the answer to your last question is ... p is just a pointer (it maybe a pointer to another pointer but it still is a pointer)..and when we want to know what value a pointer is pointing to we put * (deference op.) before that pointer (only once)!
Hope,you got that Big Grin | :-D

Questionsolitaire game Pin
Member 115602925-Apr-15 5:19
MemberMember 115602925-Apr-15 5:19 
AnswerRe: solitaire game Pin
Richard MacCutchan5-Apr-15 6:39
communityengineerRichard MacCutchan5-Apr-15 6:39 
QuestionFast object tracking code Pin
Member 1051522512-Mar-15 23:35
professionalMember 1051522512-Mar-15 23:35 
Questionhow to use hook for mouse simulation Pin
Omarkkk10-Mar-15 3:02
MemberOmarkkk10-Mar-15 3:02 
AnswerRe: how to use hook for mouse simulation Pin
Richard MacCutchan10-Mar-15 7:04
communityengineerRichard MacCutchan10-Mar-15 7:04 
GeneralRe: how to use hook for mouse simulation Pin
Omarkkk10-Mar-15 7:08
MemberOmarkkk10-Mar-15 7:08 
GeneralRe: how to use hook for mouse simulation Pin
Richard MacCutchan10-Mar-15 7:28
communityengineerRichard MacCutchan10-Mar-15 7:28 
GeneralRe: how to use hook for mouse simulation Pin
Omarkkk10-Mar-15 7:37
MemberOmarkkk10-Mar-15 7:37 
GeneralRe: how to use hook for mouse simulation Pin
Richard MacCutchan10-Mar-15 7:58
communityengineerRichard MacCutchan10-Mar-15 7:58 
GeneralRe: how to use hook for mouse simulation Pin
Omarkkk10-Mar-15 8:03
MemberOmarkkk10-Mar-15 8:03 
GeneralRe: how to use hook for mouse simulation Pin
Richard MacCutchan10-Mar-15 8:10
communityengineerRichard MacCutchan10-Mar-15 8:10 
GeneralRe: how to use hook for mouse simulation Pin
Omarkkk10-Mar-15 8:20
MemberOmarkkk10-Mar-15 8:20 
GeneralRe: how to use hook for mouse simulation Pin
Richard MacCutchan10-Mar-15 8:37
communityengineerRichard MacCutchan10-Mar-15 8:37 
Questionprogram is crash. help me Pin
dongchul-lee25-Feb-15 21:12
Memberdongchul-lee25-Feb-15 21:12 
SuggestionRe: program is crash. help me Pin
Richard MacCutchan25-Feb-15 22:41
communityengineerRichard MacCutchan25-Feb-15 22:41 
QuestionA brief question Pin
Member 1065708311-Feb-15 23:47
MemberMember 1065708311-Feb-15 23:47 
AnswerRe: A brief question Pin
Richard MacCutchan12-Feb-15 0:05
communityengineerRichard MacCutchan12-Feb-15 0:05 

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.