Erik Stryshak Erik Stryshak - 4 years ago 130
C++ Question

What is a char* when set equal to ""?

I am trying to write my own string class for an assignment, and I was wondering how I should treat the argument of "".

For example, if there is a call of:

s = myString("")


what is the length, and what are the contents of the char* holding the data in my 'myString' class?

Answer Source

The char * passed to you will be a pointer to an empty string, most likely a single, immutable byte whose contents is zero.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download