Passing value to a function - C Function

C examples for Function:Function Parameter

Description

Passing value to a function

Demo Code

#include <stdio.h>

float x = 3.5, y = 5.1, z;

float half_of(float k)
{
    return (k/2);
}

int main( void )
{
    z = half_of(x);//from   w ww .  j a v  a  2  s  .c  o m

    printf("The value of z = %f\n", z);

    z = half_of(y);

    printf("The value of z = %f\n", z);

    return 0;
}

Related Tutorials