Create the header file "pointer.h" and define the methods of the following functions using pointers as function parameters:
C programming
2. Create the header file "pointer.h" and define the methods of the following
functions using pointers as function parameters:
void areaCircle(int *radius, int *acirc)
{
/*compute the area of a circle and store the result to
the variable pointed by *acirc .*/
}
void circumCircle(int *radius,int *circumCircle)
{
/*compute the circumference of a circle andd store the result
to the variable pointed by *circumCircle */
}
void diaCirc(int *radius, int diamCirc)
{/*compute the diameter of a circle andd store the result
to the variable pointed by *diamCirc */
}
void swap(int *a, int *b)
{
/* write methods that will swap the value of a and b, such that
the value of a is b and b is a.
Example:
Values of a and b BEFORE Values of a and b AFTER
swap() swap()
a=10 a=20
b=20 b=10 */
}
void squareOrCube(int *x, int *result)
{
if the value of the variable pointed by x is ODD compute for the Square of
the number, where result=x * x. If it is EVEN compute for the cube of the
number, where result= x*x*x */
}
Step by step
Solved in 2 steps