basic-c/schemes/pointer.tex

36 lines
2.2 KiB
TeX
Raw Normal View History

\tikzset{every picture/.style={line width=0.75pt}} %set default line width to 0.75pt
\usetikzlibrary{arrows.meta}
\begin{tikzpicture}[x=0.75pt,y=0.75pt,yscale=-1,xscale=1]
%uncomment if require: \path (0,460); %set diagram left start at 0, and has height of 460
% rect val
\draw (40, 150) -- (200, 150) -- (200, 220) -- (40, 220) -- cycle ;
% rect var
\draw (220, 60) -- (380, 60) -- (380, 130) -- (220, 130) -- cycle ;
% rect addr
\draw (400, 150) -- (560, 150) -- (560, 220) -- (400, 220) -- cycle ;
% rect ptr
\draw (220, 240) -- (380, 240) -- (380, 310) -- (220, 310) -- cycle ;
% Arrow var-addr
\draw [-{To[width=3mm, length=5mm]}] (380, 95) -- (480, 150) ;
% Arrow addr-ptr
\draw [-{To[width=3mm, length=5mm]}] (480, 220) -- (380, 275);
% Arrow ptr-val
\draw [{To[width=3mm, length=5mm]}-{To[width=3mm, length=5mm]}] (220, 275) -- (120, 220);
% Arrow val-var
\draw [{To[width=3mm, length=5mm]}-{To[width=3mm, length=5mm]}] (120, 150) -- (220, 95);
% Arrow ptr-var
\draw [dotted,-{To[width=3mm, length=5mm]}] (300, 240) -- (300, 130);
\draw (440,80) node [anchor=north west][inner sep=0.75pt] [align=left] {Хранит своё\\значение по};
\draw (55,160) node [anchor=north west][inner sep=0.75pt] [align=left] {Значение переменной};
\draw (250,75) node [anchor=north west][inner sep=0.75pt] [align=left] {Переменная \\(идентификатор)};
\draw (450,165) node [anchor=north west][inner sep=0.75pt] [align=left] {Адрес};
\draw (260,250) node [anchor=north west][inner sep=0.75pt] [align=left] {Указатель};
\draw (440,270) node [anchor=north west][inner sep=0.75pt] [align=left] {Сохраняется в};
\draw (100,70) node [anchor=north west][inner sep=0.75pt] [align=left] {Простое чтение\\и/или запись};
\draw (65,255) node [anchor=north west][inner sep=0.75pt] [align=left] {Разыменование\\(как для чтения, так\\и для записи)};
\draw (250,160) node [anchor=north west][inner sep=0.75pt] [align=left] {тоже переменная\\поэтому для него\\тоже создаётся\\идентификатор};
\end{tikzpicture}