Create and Use Function with Parameters in C:
(1) FUNCTION in C language is already explained in the blog “How to create and use Function in C Language”. In this blog, we will see how to pass parameters in the function to get results.
(2) You can add as many parameters as you want.
(3) Sample C language code and its output, as shown. In this example, we created a Function with one parameter.
// Creation of new function with parameter
void myfirstfunction(int x)
x = 3;
myfirstfunction(x); //call the function by passing x parameter
(4) After that go to the “Build” menu and select the “Build” option for publishing the code as shown.
(5) After building the code, press the “Run” button, as shown.
(6) After building the code, press the “Run” button, as shown.
- Function with one parameter: MyFirstFunction(int x)
- Function with more than one parameter: MyFirstFunction(int x,char a)