FORTRAN does; well, preceding concepts like pass-by-reference, you should probably say that it uses pass-by-address; FORTRAN function, for example:
INTEGER FUNCTION MULTIPLY_TWO_INTS(A, B) INTEGER A, B MULTIPLY_BY_TWO_INTS = A * B RETURN
will have a C-style prototype:
extern int MULTIPLY_TWO_INTS(int *A, int *B);
and you could call it through something like:
int result, a = 1, b = 100; result = MULTIPLY_TWO_INTS(&a, &b);
Another example is languages ββthat do not know the function arguments as such, but use stacks. An example is Forth and its derivatives, where a function can change a variable space (stack) depending on what it wants, changing existing elements, as well as adding / removing elements. The "prototype comments" at Fort usually looks something like
(argument list -- return value list)
and this means that the function accepts / processes a certain, not necessarily constant number of arguments and returns, again, not necessarily a constant number of elements. That is, you can have a function that takes the number N as an argument and returns N elements - the preliminary distribution of the array, if you like it.
source share