I have used C for years but I'm only now learning to use Delphi. I would appreciate any tips on potential pitfalls.
I have seen examples using pointer dereferences, such as "*p" in C vs. "p^" in Delphi, but what is the Delphi equivalent of "p = p->next;"?
I have tried converting some C code to Delphi, but I keep getting a "E2029 Statement expected but type found at line" message. As far as I can tell, type is a legal statement,
Here is the code fragment:
procedure TElements.Button1Click(Sender: TObject);
begin
// No element has more than 10 oxidation states
Const MAX_OXIDATION_STATES:integer = 10;
Const TOTAL_ELEMENTS:integer = 118;
var AtomicNumber1:integer := 0;
var AtomicNumber2:integer := 0;
var leastCommonMultiple:integer;
var ratio1:integer;
var ratio2:integer;
var Combinations:integer;
var valence1:integer;
var valence2:integer;
var v1:integer;
var v2:integer;
var errorMessage:string;
// Instantiate 118 objects, one for each element
type AllElements = record
Number: integer; // Atomic number
Symbol: string; // Element symbol
Name: string; // Element name
AlphaSeq: integer; // Name alphabetical sequence number
Mass: double; // Atomic number
Oxidation: string; // Oxidation states
end;
Any suggestions? Thanks for any tips!
Tom