Pointers and references: Difference between revisions

Content deleted Content added
PureFox (talk | contribs)
Added FreeBASIC
PatGarrett (talk | contribs)
→‎{{header|PL/I}}: Section added
Line 1,012:
: L # Look at the modified list in 'L'
-> (1 a 2 "Hello" 3 c)</lang>
 
=={{header|PL/I}}==
PL/I has a large set of tools for pointers and references:
* variable attributes: BASED, POINTER, but also AREA and OFFSET
* functions: ADDR
* control statements: ALLOCATE, FREE
Simple examples:
<lang pli>
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 */
</lang>
 
 
=={{header|Pop11}}==
Line 1,050 ⟶ 1,082:
(with pointer arithmetics), but those does not count as "basic data
operation".
 
=={{header|PureBasic}}==
===Pointers===