I am looking at some legacy C code.
char * b = (char *)malloc(l+1) ;
If i were to use new operator, it will be declared as
char * b = new b ;
Would that be correct?
Thx
Lawina
I am looking at some legacy C code.
char * b = (char *)malloc(l+1) ;
If i were to use new operator, it will be declared as
char * b = new b ;
Would that be correct?
Thx
Lawina
This might be more likely:
But then you might just use std::string instead.Code:char* b = new char[l+1];
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
and be sure to use delete in place os the corresponding free().
Code:char* b = new char[l+1]; delete [] b;
Thanks guys.