114
Pascal 4.0 User’s Guide
6
Arrays
Since C cannot pass arrays by value, it cannot pass strings of characters, fixed
arrays, or
univ
arrays by value.
Conformant Arrays
Pascal passes all value parameters on the stack or in registers, except for value
conformant array parameters, which are handled by creating a copy in the
caller environment and passing a pointer to the copy. In addition, the bounds
of the array must be passed (see “Conformant Arrays” on page 101).
This example is the same as the single-dimension example in “Conformant
Arrays,” except that the
var
prefix is deleted.
The Pascal procedure,
ChrCAVal.p
procedure ChrCAVal(a: array [lb..ub: integer] of char);
begin
a[0] := 'T';
a[13] := 'o';
end; { ChrCAVal }
The C main program,
ChrCAValMain.c
#include <stdio.h>
extern void ChrCAVal(char [], int, int);
int main(void)
{
static char s[] = "This is a string";
ChrCAVal(s, 0, sizeof(s) -1);
printf(" %11s \n", s);
}
Summary of Contents for SunSoft Pascal 4.0
Page 14: ...xiv Pascal 4 0 User s Guide ...
Page 16: ...xvi Pascal 4 0 User s Guide ...
Page 30: ...6 Pascal 4 0 User s Guide 1 ...
Page 160: ...136 Pascal 4 0 User s Guide 6 ...
Page 268: ...244 Pascal 4 0 User s Guide 11 ...
Page 320: ...296 Pascal 4 0 User s Guide B ...
Page 331: ...Index 307 ...
Page 333: ......