c++ - What is the difference between following two snippets? -


char *t=new char(); 

and

char *t=new char[102]; 

as code accepted using latter one?

//bishops spoj 

char *t=new char(); 

allocates memory single character, , calls default constructor.

char *t=new char[102]; 

creates array of 102 chars , calls default constructor.

as default constructor pod types nothing, difference amount of memory allocated (single char vs array of char)


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

reflection - How to access the object-members of an object declaration in kotlin -

php - Doctrine Query Builder Error on Join: [Syntax Error] line 0, col 87: Error: Expected Literal, got 'JOIN' -