Hi all,
why I am getting "access violation" in line 1 below in foo(...)?
void foo( char* str )
{
if( str != NULL && strlen(str) > 0 )
{
str[0] = '9'; // line 1
}
}
int main(int argc, char* argv[])
{
char* str2 = "123456789";
foo( str2);
return 0;
}
| CodeGuru Home | VC++ / MFC / C++ | .NET / C# | Visual Basic | VB Forums | Developer.com |
|
Results 1 to 7 of 7
Thread: Why the Access violation here ?Threaded View
|
Click Here to Expand Forum to Full Width |