RosettaCodeData/Task/Pointers-and-references/PL-I/pointers-and-references.pli
2023-07-01 13:44:08 -04:00

22 lines
526 B
Text

dcl i fixed bin(31);
dcl p pointer;
dcl j fixed bin(31) based;
i=5;
p=addr(i);
p->j=p->j+1; /an other way to say i=i+1 */
put skip edit(i)(F(5)); /* -> 6 */
/* second form */
dcl i fixed bin(31);
dcl j fixed bin(31) based(p);
i=5;
p=addr(i);
j=j+1; /* an other way to say i=i+1 */
put skip edit(i)(F(5)); /* -> 6 */
/* cascading pointers */
dcl (p,q,s,t) pointer;
dcl (j,k) fixed bin(31) based;
dcl (i1,i2) fixed bin(31);
p=addr(i1); t=addr(i2), q=addr(p); s=addr(t);
q->p->j = s->t->k + 3; /* to say i1=i2+3 */