Re:Why I Chose to Learn C
by drivers99 on Friday March 29, 2013 @04:44PM
(#5462947)
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:
Variables are declared like this:
for example, here is an integer i and a pointer to an integer p: ^ reads like "pointer to" here.If you want to point p to i's address:
@ 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:
The equivalent C would be: I guess it's not that different.