What does carriage (^.) Mean?

What does the following Pascal code mean?

p^.rlink=q q^.llink=p 
+4
source share
5 answers

Pascal ^. operator similar to the -> operator in C and C ++.

It looks for a pointer (in your case, p must be defined as var p: ^type ) and accesses the variable in the record, in this case rlink and llink .

+10
source

When the carriage (^) appears after the pointer variable, it plays out the pointer, that is, it returns the value stored at the memory address held by the pointer. Therefore, in your case, I assume that p is a pointer to a record with the rlink attribute and q is a pointer to a record with the llink property. These properties also indicate the same structure, because then p and q are assigned to them. I believe this structure is a binary tree data type with left and right nodes.

+4
source

The probable probability that p and q are elements in a doubly linked list , often called a bidirectional linked list. These two statements put them together, with p located on the β€œleft” and β€œright”. The equivalent in C / C ++ would be:

 p->rlink = q; q->llink = p; 
+3
source

^ follow the sign as well . - access to the entry item. So these lines are probably rearranging links in graph .

0
source

p and q seem to be pointers. They point to record variables that have respectively (or, possibly, both), rlink and llink (correct guessing link and left link).

This snippet is probably used in the context of a graph, or possibly a linked list.

The carriage operator (^) in Pascal is a dereference operator that allows you to access the contents of a variable, not the pointer.

The direct equivalent in C would be

 (p*).rlink=q (q*).llink=p 

but of course this is usually expressed as

 p->rlink=q q->llink=p 

with the operator C β†’, which performs deferment and member access to one step.

0
source

All Articles