Function prototype: Difference between revisions

Content added Content deleted
(Added Ada)
({{header|C}})
Line 28: Line 28:
next : accBox; -- including that a box holds access to other boxes
next : accBox; -- including that a box holds access to other boxes
end record;</lang>
end record;</lang>

=={{header|C}}==

Function prototypes are typically included in a header file at the beginning of a source file prior to functional code. However, this is not enforced by a compiler.

<lang c>int noargs(); /* Declare a function with no arguments that returns an integer */
int twoargs(int a,int b); /* Declare a function with no arguments that returns an integer */
int twoargs(int ,int); /* Parameter names are optional in a prototype definition */
int anyargs(...); /* An ellipsis can be used to declare a function that accepts varargs */
int atleastoneargs(int, ...); /* Declare a fuction that has one mandatory integer argument followed by varargs */</lang>



=={{header|Common Lisp}}==
=={{header|Common Lisp}}==