In the C language, a pointer can point to a function. This pointer also has two properties, but one is the entry address of the function, and the other is the return type of the function. For example, the following program, which is correct in the C language:
int time12 (int i)
{return (I%12);
}
int main ()
{int (*FP) () =time12;
INTT=FP (13);
Return0;
}
The first sentence of the main function is a definition statement. We should read from the identifier to the left of the equals sign, except for identifiers that appear on the left side of the equals sign, which are read in the order in which the symbol is used as the operator. This punctuation: FP is a pointer, it points to a function (note that the C language allows its parameter types not to be written out), the return value of this function is int, and this pointer is initialized to the entry address of the function time12.
However, the above procedure in C + +, the first statement is considered to be wrong. C + + is a strongly typed check language, which is related to the function overload mechanism of C + +. C + + requirements must indicate the type of all formal parameters of the function. The following program is the correct C + + program:
int time12 (int i)
{return (I%12);
}
int main ()
{int (*FP) (int) =time12;
INTT=FP (13);
Return0;
}