I have to rewrite following C code to Delphi:
register short* p;
short k;
int i;
k = p[i];
The result looks so:
{$POINTERMATH ON}
var
p: ^SmallInt;
k: SmallInt;
i: Integer;
begin
k := p[i];
end;
Now I am a bit unsure about pointer math used here.
Does p[i] mean that p is taken and then advanced for i bytes?
Or may be p is taken and then advanced for i 16-bit words?
Also I'm unsure about Delphi pointer math syntax. Logically p[i] in Delphi code should look for me like p[i]^, but the last variant produces a compiler error "E2017 Pointer type required".
Is my code conversion attempt correct?