Hi
I'm testing to change a string by its pointer, and the debugger raises an error for that, any opinion on why is this happening?
When I SetLength the string, it's working okay, like it's treating the var string as const in the first place.
Here are the code and sample project of the situation.
program Project1;
var
S1, S2: String;
P: PChar;
begin
SetLength(S1, 3);
P := Pointer(S1);
P^ := '1';
S2 := 'ABC';
P := Pointer(S2);
P^ := '1';
ReadLn;
end.