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
Printable View
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];
and be sure to use delete in place os the corresponding free().
Code:char* b = new char[l+1];
delete [] b;
Thanks guys.