* srktnc:
In header file, I have the following 2 private data members along with
constructors:
char* _str;
unsigned _len;
The constructor I am having problem with is
"STRING (const char*)"
Do not use all uppercase for non-macro names. All uppercase is a macro name
convention that helps avoid name collisions, _if_ you don't use it elsewhere.
that converts a null-terminated array to a string.
-----------------------------------------------
I set private data member values as shown below:
_len=0;
_str=NULL;
Actually you don't.
My implementation for THAT constructor is as shown below:
STRING::STRING(const char* c)
/* Pre condition: Array passed must be a valid character array */
{
for (int i=0; c[i]!=NULL; i++)
_len++;
'_len' is uninitialized, an arbitrary value.
--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?