Что каре отмечает точкой (^). средний?

Принятие его имеет поиск "регулярных выражений", ищите \r\n. Я предпочитаю \r? \n, потому что некоторые файлы не используют возвраты каретки.

РЕДАКТИРОВАНИЕ: Спасибо за обратную связь, кто бы ни провалил это. Я узнал, что... хорошо, ничто, потому что Вы не обеспечили обратной связи. Почему эта несправедливость?

5
задан Dukeling 2 July 2013 в 14:36
поделиться

5 ответов

The pascal operator ^. is similar to operator -> in C and C++.

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

11
ответ дан 18 December 2019 в 09:07
поделиться

When caret (^) appears after a pointer variable it dereferences the pointer, that is, it returns the value stored at the memory address held by the pointer. So in your case I suppose that p is a pointer to a record that has rlink property and q is a pointer to a record that has llink property. These properties are also pointers to the same structure, because p and q are then assigned to them. I suppose that this structure represents a binary tree data type with left and right nodes.

4
ответ дан 18 December 2019 в 09:07
поделиться

A likely possibility is that p and q are elements in a doubly-linked list, often called a bi-directional linked list. Those two statements are attaching them together, with p on the "left" and q on the "right". An equivalent in C/C++ would be:

p->rlink = q;
q->llink = p;
3
ответ дан 18 December 2019 в 09:07
поделиться

The ^'s follow a pointer, and the . access a member of a record. So these lines are probably rearranging the links in a graph of some kind.

0
ответ дан 18 December 2019 в 09:07
поделиться

p and q appear to be pointers. They point to a record variables which have respectively (or probably both), a rlink and llink (guessing right link and left link).

This snippet is probably used in the context of a graph or maybe a linked list of sorts.

The caret (^) operator, in Pascal, is the dereference opertator which enables one to access the variable content not the the pointer.

The direct equivalent in C language would be

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

but of course this would typically be expressed as

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

with C's -> operator which does a deferencing and member access in one step.

0
ответ дан 18 December 2019 в 09:07
поделиться
Другие вопросы по тегам:

Похожие вопросы: