![](/images/backgrounds/286549/hp-sunsoft-pascal-4-0-users-manual-549395135x1.png)
6
The Pascal procedure, IntSetVar.p, which has an intset of the elements [1, 3, 7, 8]
The C main program,
IntSetVarMain.c
The Pascal intset type is predefined as set of [0..127]. A variable of this type takes 16 bytes of storage.
procedure IntSetVar(var s: intset); begin
s := [1, 3, 7, 8] end; { IntSetVar }
#include <stdio.h>
extern void IntSetVar(unsigned int *);
int main(void)
{
int w ;
unsigned int *p, *s ;
s = (unsigned int *) malloc(16); IntSetVar(s) ;
for (w = 0, p = s ; w < 4 ; w++, p++) printf("%012o %3d \n", *p, w);
printf(" 110 001 010 (binary, word 4) \n"); printf(" 876 543 210 (bits, word 4)" \n");
}
The commands to compile and execute IntSetVar.p and IntSetVarMain.c. The output of this example depends on the architecture of your machine.
hostname% pc
hostname% cc IntSetVar.o IntSetVarMain.c
000000000000 0
000000000000 1
000000000000 2
000000000612 3
110 001 010 (binary, word 4)
876 543 210 (bits, word 4)
The | 111 |