I have a funtion executing a loop, which semes to be progressing normally until the debugger halted with this message;

Program received signal SIGSEGV, Segmentation fault.

I pulled up a a backtrace and it had "normal lookuing" addresses for the this pointer and the reference variable.

I could probably figure this out if I only knew what he hell the debugger was trying to tell me.! Anyone?

Thanks, I found it.
I had left out the definition of "i" in a "i,j type for loop"
The i=itsLen was omitted in the 2nd loop.
I guess that caused the program to attempt to put a string of some number of charactors into a string of size zero???

//creates a new String by adding current
//String to rhs
String String::operator+(const String& rhs)
{
    int totalLen = itsLen + rhs.GetLen();
    String temp(totalLen);
    int i, j;
    for (i =0; i < itsLen; i++)
        temp[i] = itsString[i];
    for (j= 0, i=itsLen; j < rhs.GetLen(); j++, i++)
        temp[i] = rhs[j];
    temp[totalLen]='\0';
  return temp;
 }

The other thing i don't quite understand is how the string is returned if the previous line sets the array to null? Is this something the compiler resolves, even though the sequence is wrong?
this code now works as advertised...

It seems you have taken the long way around with that entire function. This should do it.

//creates a new String by adding current
//String to rhs
String String::operator+(const String& rhs)
{
    String temp;
    temp = itsString + rts;
    return temp;
 }
This question has already been answered. Start a new discussion instead.