Click here to Skip to main content
15,914,160 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: CComboBox Pin
Andrew Quinn AUS20-May-04 22:51
Andrew Quinn AUS20-May-04 22:51 
GeneralOdd effect in .net 2003 using c++forms Pin
hjimmy20-May-04 22:15
hjimmy20-May-04 22:15 
GeneralIdenfy a PC Pin
ivax20-May-04 22:06
ivax20-May-04 22:06 
GeneralRe: Idenfy a PC Pin
Andrew Quinn AUS20-May-04 23:30
Andrew Quinn AUS20-May-04 23:30 
GeneralRe: Idenfy a PC Pin
Dennis Gourjii21-May-04 3:00
Dennis Gourjii21-May-04 3:00 
GeneralSerial Port - overlapped I/O - WaitCommEvent/SetCommMask/ReadFile/etc questions Pin
AnotherProgrammer20-May-04 21:50
AnotherProgrammer20-May-04 21:50 
GeneralRe: Serial Port - overlapped I/O - WaitCommEvent/SetCommMask/ReadFile/etc questions Pin
Paul Ranson21-May-04 7:37
Paul Ranson21-May-04 7:37 
GeneralC++ object pointers Pin
Anonymous20-May-04 21:47
Anonymous20-May-04 21:47 
Hi,

I just couldn't find any other forumn, where I can post my C++ questions. So sorry for posting it here in the VC++ discussion board.

Pl. see the code below.

void Allocate( char* s )
{
s = (char*)malloc( 100 );
}

int main( )
{
char* s = NULL;
Allocate( s );
strcpy( s,"Test"); //I know that this will fail. b'coz I still have a NULL pointer in s. Initially s was pointing to NULL, and from the function Allocate 100 bytes of memory was allocated in some memory location, and address of s was made to point to that location. But inside the main, s is still pointing to NULL. Pl. correct me if I am wrong.

}

Now my question is

void Allocate( Base* s )
{
s = new Base;
}

int main( )
{
Base* obj = NULL;
Allocate( obj );
obj->some_member = 20; // this works...

}

So I assume, object pointers are passed to functions in a different way compared to primitive type pointers. Can anyone pl. comment on this.

Regards
Jugs...
GeneralRe: C++ object pointers Pin
Steve S21-May-04 0:20
Steve S21-May-04 0:20 
GeneralRe: C++ object pointers Pin
mirex21-May-04 1:16
mirex21-May-04 1:16 
General"int" to "CY" Pin
Hing20-May-04 21:26
Hing20-May-04 21:26 
GeneralRe: "int" to "CY" Pin
Maxwell Chen20-May-04 21:43
Maxwell Chen20-May-04 21:43 
GeneralRe: "int" to "CY" Pin
Hing20-May-04 21:44
Hing20-May-04 21:44 
GeneralRe: "int" to "CY" Pin
Maxwell Chen20-May-04 23:50
Maxwell Chen20-May-04 23:50 
GeneralRe: "int" to "CY" Pin
Hing20-May-04 23:52
Hing20-May-04 23:52 
GeneralModeless dialog problem Pin
krugger20-May-04 21:26
krugger20-May-04 21:26 
GeneralRe: Modeless dialog problem Pin
Ernesto D.20-May-04 22:36
Ernesto D.20-May-04 22:36 
GeneralHTML help in Visual C++ project Pin
krugger20-May-04 20:51
krugger20-May-04 20:51 
GeneralRe: HTML help in Visual C++ project Pin
Dennis Gourjii21-May-04 3:11
Dennis Gourjii21-May-04 3:11 
GeneralRe: HTML help in Visual C++ project Pin
*Dreamz21-May-04 3:55
*Dreamz21-May-04 3:55 
GeneralHelp!automatically read the file Pin
jfk_lili20-May-04 19:56
jfk_lili20-May-04 19:56 
GeneralRe: Help!automatically read the file Pin
mirex20-May-04 21:23
mirex20-May-04 21:23 
GeneralRe: Help!automatically read the file Pin
Steve S21-May-04 0:29
Steve S21-May-04 0:29 
GeneralMenu Controls Pin
Eversman20-May-04 18:39
Eversman20-May-04 18:39 
GeneralRe: Menu Controls Pin
*Dreamz20-May-04 19:03
*Dreamz20-May-04 19:03 

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.