Hey guys,
So I today I converted my programs from VS 2005 to VS 2010.
I came across an issue involving the string null terminator ('\0') in a function of mine. (Note: It worked in VS 2005).
int StrLength(string str)
{
int i = 0;
while(str[i] != '\0')
{
i++;
}
return i;
}
I get the error: 'string subscript out of range'.
My take on this is that when the index gets to the end of the string (where it should compare the null terminator) it has already jumped off the end of the string.
I'm probably wrong though.
Does anyone have any idea what to do here? Any help is appreciated.