max characters of an array of char
-
Hi ! I have declare an array of characters like this : char lStr[255]; But , i want to declare a bigger capacity of this array . So i want to kow the maximum characters, i can declare in a array of characters ? :)
It'll be governed by the size of the stack, which I think defaults to 1MB.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
-
Hi ! I have declare an array of characters like this : char lStr[255]; But , i want to declare a bigger capacity of this array . So i want to kow the maximum characters, i can declare in a array of characters ? :)
I suggest using vector or, if in MFC, CArray. Both use the heap, instead of stack, and maintain the count. Option 2 is to simply use:
char* pStr = new char[255];
But make sure you delete it when you got out of scope (or use a smart pointer class.) Anyone who thinks he has a better idea of what's good for people than people do is a swine. - P.J. O'Rourke