The following error occurs when working with char data in C:
Run-time Check Failure #3-the variable ' str ' is being used without being defined.
This is typically caused by not allocating storage space to the char* str when it is defined.
Such as:
char* str;
strcpy (str, "string");
The above error will occur.
But if it is defined as:
Char str[10];//Note that the string length is at least greater than one character below the string length.
strcpy (str, "string");
There will be no error.
The character space of Str can also be allocated dynamically.
char* str;
str = (char*) malloc (strlen ("string") *sizeof (char));
strcpy (str, "string");
This problem may also occur when there is an access violation occurring at the write location.
Such as:
Unhandled exception at 0x102aece9 (Msvcr80d.dll) in XX.exe: 0xC0000005: Access violation when writing to location 0x004156b4