A.8. Functions

Functions perform tasks. Tasks may be useful to other functions defined within the same source code file, or they may be used by a function external to the source file. A function has a name (that you supply) and a list of zero or more arguments that are passed to it. Note that your function name cannot contain a number in the first couple of characters. A function has a body enclosed within curly braces that contains instructions for carrying out the task. A function may return a value of a particular type. C functions pass data by value.

Functions either return a value of a particular data type (for example, real), or do not return any value if they are of type void. To determine the return data type for the DEFINE macro you will use to define your UDF, look at the macro’s corresponding #define statement in the udf.h file or see Appendix B: DEFINE Macro Definitions for a listing.


Important:  C functions cannot alter their arguments. They can, however, alter the variables that their arguments point to.