C Parameter Types

All of the data types supported in C can be passed between a C client program and a C library, with a few exceptions that are documented in the C Programming Reference Manual, Volume 1: Basic Implementation.

The data types that can be passed between C libraries and client programs in other languages, or between C client programs and libraries in other languages, are much more limited. C Parameters lists the C parameter types available for interlanguage library calls, and the ALGOL equivalents of these C parameter types.

Table 12. C Parameters

ALGOL Parameter

Corresponding C Parameters

BOOLEAN

int (both signed and unsigned types)

INTEGER

char

int (both signed and unsigned types)

short (both signed and unsigned types)

long (both signed and unsigned types)

pointers (all types)

REAL

float

double

DOUBLE

long double

INTEGER ARRAY

int [ ]

short [ ]

long [ ]

EBCDIC ARRAY

char [ ]

__heap_t

REAL ARRAY

float [ ]

double [ ]

long double [ ]

struct

union

FILE

_file_t

INTEGER PROCEDURE

char ()

int ()

short ()

long ()

REAL PROCEDURE

float ()

double ()

DOUBLE PROCEDURE

long double ()

PROCEDURE

void ()


The __heap_t parameter passes the value of the heap, which is a memory area where a C program stores arrays, structures, addressed objects, and dynamically allocated objects.

Pointers in C are integer types that indicate the location of an item within the heap. The exact meaning of C pointers varies according to the memory model used for the C program; the programmer can request a particular memory model with the MEMORY_MODEL compiler control option. If the heap is implemented with a MEMORY_MODEL value of TINY or SMALL, then a non-C program that calls a C library can use the C pointer as an indicator of the offset of the item within a heap. If the heap is implemented with a different MEMORY_MODEL value, then the non-C program must use the __heap_to_ptr_t procedure to convert the C pointer into a conventional pointer.

The __heap_to_ptr_t procedure is one of several export procedures that the C compiler automatically creates in each C library. Other procedures that aid in array handling include __copy_to_ptr_t, __copy_from_ptr_t, __free_t, and __malloc_t. These procedures can be accessed only by programs written in ALGOL (including any of the extended forms of ALGOL), NEWP, or Pascal. For examples of the use of some of these procedures, refer to Server Library Examples.