int main(void) {
const char* str1 = "String1";
char* const str2 = "String2";
char* p = "Testing!";
*str1 = 'X'; // Error: Assignment to const location.
str1 = p; // it works.
*str2 = 'X'; // Oops ...
str2 = p; // Error: Assignment to const identifier 'str2'.
return 0;
}
Hi Pelle, this statement *str2 = 'X'; passed the compilation but the
program crashed. What's wrong with it? It should work, right?
I am using your software to learn Win32API programming now but I have a long time no using C language to program, so I perhaps made some mistakes, thanks for your help again ... Have a nice day!
Barney.