LiquidBinary
Programmer
What are the advantages to say ->
void someFun()
{
char *sString = new char[MAX];
//Some code.
delete [] sString;
}
VS.
void someFun()
{
char sString[MAX];
//Some code.
}
I am having a hard time finding clarification on something...When the second function ends, do the contents (if any) of sString just get discarded, or does the entire memory space get de-allocated? If only the contents of sString get discarded (not the memory space) then the first function would be justified, right? Is there really any sense in dynamically allocating an array if you all ready know the MAX size before hand? Mike L.G.
mlg400@blazemail.com
void someFun()
{
char *sString = new char[MAX];
//Some code.
delete [] sString;
}
VS.
void someFun()
{
char sString[MAX];
//Some code.
}
I am having a hard time finding clarification on something...When the second function ends, do the contents (if any) of sString just get discarded, or does the entire memory space get de-allocated? If only the contents of sString get discarded (not the memory space) then the first function would be justified, right? Is there really any sense in dynamically allocating an array if you all ready know the MAX size before hand? Mike L.G.
mlg400@blazemail.com