Gotcha (programming) - Gotchas in The C Programming Language - Function Calls

Function Calls

Example from C and relatives:

/* File name: fortytwo.c */ #include foo { printf(" 42!n"); } int main { printf("I will here below write '42':n"); foo; printf("I think I wrote '42', but I'm not quite sure...n"); return 0; }

will produce (when compiled and run):

$ ./fortytwo I will here below write '42': I think I wrote '42', but I'm not quite sure...

What foo; expression counterintuitively does is returning the address of the function foo. What the programmer intended was probably instead the function call:


where the parenthesis indicates a function call with zero arguments.

Read more about this topic:  Gotcha (programming), Gotchas in The C Programming Language

Other articles related to "function calls, calls, function":

BioJava - Modules - Protein Disorder Module - Making Library Function Calls
... show how to use the module and make function calls to get information about protein disorders ... The first two examples make library function calls to calculate the probability of disorder for every residue in the sequence provided ...
... of an operating system, of applications, or of other software components by intercepting function calls or messages or events passed between software components ... Code that handles such intercepted function calls, events or messages is called a "hook" ... an application, or intercepting operating system calls in order to monitor behavior or modify the function of an application or other component ...

Famous quotes containing the words calls and/or function:

    The timid man calls himself cautious, the sordid man thrifty.
    Publilius Syrus (1st century B.C.)

    The more books we read, the clearer it becomes that the true function of a writer is to produce a masterpiece and that no other task is of any consequence.
    Cyril Connolly (1903–1974)