# Include "stdio. H"
# Include "conio. H"
# Define M 8
Float max (float a [], int N);/** // * function declaration */
Void main ()
{
Clrscr ();
Float sumf, sump;
Float a [m] = {4.5,-3 };
Float (* p) (float a [], INT);/** // * defines the pointer to the function P */
P = max;/** // * function name (function entry address) assigned to pointer p */
Sump = (* p) (a, m);/** // * call a function using a pointer */
Sumf = max (a, m);/** // * use the function name to call the max () function */
Printf ("sump = %. 2f \ n", sump );
Printf ("sumf = %. 2f \ n", sumf );
}
Float max (float a [], int N)
{
Int K;
Float S;
S = A [0];
For (k = 0; k <n; k ++)
If (S <A [k]) S = A [k];
Return S;
}
Input two straight corner edges of a triangle in the main function to obtain the area and length of the triangle.
# Include "stdio. H"
# Include "conio. H"
# Include "math. H"
Float area (INT, INT );
Float length (INT, INT );
Float F (INT, Int, float (* p) (INT, INT ));
Void main ()
{
Clrscr ();
Int M, N;
Float S, L;
Float (* q) (INT, INT );
Scanf ("% d, % d", & M, & N );
Q = area;
S = f (m, n, q );
L = f (m, n, length );
Printf ("Area of the right triangle is %. 2f \ n", S );
Printf ("length of the hypotenuse is %. 2f \ n", L );
}
Float area (int A, int B)
{
Float Z;
Z = a * B/2;
Return Z;
}
Float length (int A, int B)
{
Float Z;
Z = SQRT (A * A + B * B );
Return Z;
}
Float F (int A, int B, float (* p) (INT, INT ))
{
Float y;
Y = (* p) (A, B );
Return y;
}