Click here to Skip to main content
15,886,840 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
AnswerRe: How to swap address of pointers of 2 variables without using a temporary variable? Pin
zhijzan7-Jun-15 20:40
zhijzan7-Jun-15 20:40 
AnswerRe: How to swap address of pointers of 2 variables without using a temporary variable? Pin
Shao Voon Wong28-Jun-15 22:13
mvaShao Voon Wong28-Jun-15 22:13 
Questionhow to migrate CORBA to Web Service in C++ Pin
VC_RYK13-Apr-15 20:20
VC_RYK13-Apr-15 20: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 15:29
Member 1160464113-Apr-15 15: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 21:33
mveRichard MacCutchan13-Apr-15 21:33 
Questionint **p = (int**)new int(5); Confusing !!! Pin
Amrit Agr5-Apr-15 8:32
Amrit Agr5-Apr-15 8:32 
AnswerRe: int **p = (int**)new int(5); Confusing !!! Pin
Richard Andrew x645-Apr-15 10:14
professionalRichard Andrew x645-Apr-15 10:14 
AnswerRe: int **p = (int**)new int(5); Confusing !!! Pin
Zabir Al Nazi Nabil5-Apr-15 11:34
professionalZabir Al Nazi Nabil5-Apr-15 11: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 4:19
Member 115602925-Apr-15 4:19 
AnswerRe: solitaire game Pin
Richard MacCutchan5-Apr-15 5:39
mveRichard MacCutchan5-Apr-15 5:39 
QuestionFast object tracking code Pin
Member 1051522512-Mar-15 22:35
professionalMember 1051522512-Mar-15 22:35 
Questionhow to use hook for mouse simulation Pin
Omarkkk10-Mar-15 2:02
Omarkkk10-Mar-15 2:02 
AnswerRe: how to use hook for mouse simulation Pin
Richard MacCutchan10-Mar-15 6:04
mveRichard MacCutchan10-Mar-15 6:04 
GeneralRe: how to use hook for mouse simulation Pin
Omarkkk10-Mar-15 6:08
Omarkkk10-Mar-15 6:08 
GeneralRe: how to use hook for mouse simulation Pin
Richard MacCutchan10-Mar-15 6:28
mveRichard MacCutchan10-Mar-15 6:28 
GeneralRe: how to use hook for mouse simulation Pin
Omarkkk10-Mar-15 6:37
Omarkkk10-Mar-15 6:37 
GeneralRe: how to use hook for mouse simulation Pin
Richard MacCutchan10-Mar-15 6:58
mveRichard MacCutchan10-Mar-15 6:58 
GeneralRe: how to use hook for mouse simulation Pin
Omarkkk10-Mar-15 7:03
Omarkkk10-Mar-15 7:03 
GeneralRe: how to use hook for mouse simulation Pin
Richard MacCutchan10-Mar-15 7:10
mveRichard MacCutchan10-Mar-15 7:10 
GeneralRe: how to use hook for mouse simulation Pin
Omarkkk10-Mar-15 7:20
Omarkkk10-Mar-15 7:20 
GeneralRe: how to use hook for mouse simulation Pin
Richard MacCutchan10-Mar-15 7:37
mveRichard MacCutchan10-Mar-15 7:37 
Questionprogram is crash. help me Pin
dongchul-lee25-Feb-15 20:12
dongchul-lee25-Feb-15 20:12 
SuggestionRe: program is crash. help me Pin
Richard MacCutchan25-Feb-15 21:41
mveRichard MacCutchan25-Feb-15 21:41 
QuestionA brief question Pin
Member 1065708311-Feb-15 22:47
Member 1065708311-Feb-15 22:47 
AnswerRe: A brief question Pin
Richard MacCutchan11-Feb-15 23:05
mveRichard MacCutchan11-Feb-15 23: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.