Lokang 

C and MySQL

Function Parameters

A function parameter in C is a variable that is declared as part of a function's signature and passed to the function when it is called. Function parameters are used to pass data to a function and to specify the type of data that the function expects to receive.

Here is an example of a function with parameters in C:

#include <stdio.h>
int add(int x, int y)
{
   return x + y;
}
int main()
{
   int result = add(3, 4);
   printf("Result: %d\n", result);
   return 0;
}

In this example, we have defined a function add that takes two integers as arguments and returns their sum. The variables x and y are the function parameters, and they are declared as part of the function's signature.

When the function is called from the main function, the arguments 3 and 4 are passed to the function and are assigned to the parameters x and y, respectively. The function performs the addition operation and returns the result, which is then assigned to the variable result and printed to the console.

Function parameters can be of any data type, and a function can have multiple parameters of different types. For example:

#include <stdio.h>

float average(float a, float b, float c)
{
    return (a + b + c) / 3;
}

int main()
{
    float result = average(3.0, 4.0, 5.0);
    printf("Result: %f ", result);
    return 0;
}