Char Array question
-
Supposing I declare a
char
array likechar p[20] = {"Hello"} ;
Where will this array of chars get created? In the Heap or the Stack? When the function where this array is declared goes out of scope, will the char array be automatically deleted or will I have to explicitly delete it?--- :beer: Hakuna-Matada :beer: It means no worries for the rest of your days... It's our problem free, Philosophy :jig:
-
Supposing I declare a
char
array likechar p[20] = {"Hello"} ;
Where will this array of chars get created? In the Heap or the Stack? When the function where this array is declared goes out of scope, will the char array be automatically deleted or will I have to explicitly delete it?--- :beer: Hakuna-Matada :beer: It means no worries for the rest of your days... It's our problem free, Philosophy :jig:
-
Supposing I declare a
char
array likechar p[20] = {"Hello"} ;
Where will this array of chars get created? In the Heap or the Stack? When the function where this array is declared goes out of scope, will the char array be automatically deleted or will I have to explicitly delete it?--- :beer: Hakuna-Matada :beer: It means no worries for the rest of your days... It's our problem free, Philosophy :jig:
-
Everything is allocated on stack unless you explicitly allocate with
new
,malloc
,realloc
...or if its global ;)