3 ms·
I took the AP CS exam in 1992 or so. My CS classes in high school were in Pascal, which is what the exam was in. I always thought the syntax in Pascal was a lit
by drivers99 14y ago
I took the AP CS exam in 1992 or so. My CS classes in high school were in Pascal, which is what the exam was in. I always thought the syntax in Pascal was a little easier to understand than C.
Variables are declared like this:
name : type;
for example, here is an integer i and a pointer to an integer p:
i : integer;
p : ^integer;
^ reads like "pointer to" here.
If you want to point p to i's address:
p := @i;
@ reads like "address of" here. "at" also makes sense. By the way := is the assignment operator.
And if you want to assign a value to what a pointer points to (in other words, deference it), you can:
p^ := 42;
The equivalent C would be:
int i;
int *p;
p = &i;
*p = 42;
I guess it's not that different.