Hi, i am coding one program by using string class but i want to replace it with const char* in order to enhance the performance.
Sample code:
vector <string> vec;
char str[10] = {"Sunday","Mond ay"............ ............}
for (int i = 0; i < 10; i++)
vec.push_back(s tr[i]);
If i use const char*, there is always memory leak.
vector <const char* > vec;
char str[10] = {"Sunday","Mond ay"............ ............}
for (int i = 0; i < 10; i++)
vec.push_back(s tr[i]);
Please help, how can i avoid such pblm .
Regards
Sample code:
vector <string> vec;
char str[10] = {"Sunday","Mond ay"............ ............}
for (int i = 0; i < 10; i++)
vec.push_back(s tr[i]);
If i use const char*, there is always memory leak.
vector <const char* > vec;
char str[10] = {"Sunday","Mond ay"............ ............}
for (int i = 0; i < 10; i++)
vec.push_back(s tr[i]);
Please help, how can i avoid such pblm .
Regards
Comment