samedi 28 mars 2020

How does Memory allocation in C++

String::String(const String& old_str)    
{ 
size = old_str.size; 
s = new char[size+1]; 

Why we use size+1 here to allocate memory. why not size?

Aucun commentaire:

Enregistrer un commentaire