Calling Function inside Function in C programming. Functions are used to divide a large program into sub-programs for easy control. All these sub-programs are called sub-functions of the program.
#include<stdio.h>
#include<conio.h>
void fun(); //defining Function 'fun()'.
void fun2(); //defining Function 'fun2()'.
void fun3(); //defining Function 'fun3()'.
void main()
{
printf("Before Calling Functions\n");
fun(); //calling 'fun2()' function.
printf("After Calling Functions\n");
getch();
}
void fun3() //this is 'fun3()' function.
{
printf("This is fun3() Function\n");
fun2(); //calling 'fun()' function.
}
void fun() //this is 'fun()' function.
{
printf("This is fun() Function\n");
fun3(); //calling 'fun3()' function.
}
void fun2() //this is 'fun2()' function.
{
printf("This is fun2() Function\n");
//if U call here 'fun();' function then it will be infinite.
}
#include<stdio.h>
#include<conio.h>
void fun(int); //defining function with Parameter.
void main()
{
int a = 8;
printf("Value of a: %d\n", a);
fun(a); //calling 'fun()' function and passing argument to parameter.
getch();
}
void fun(int x) //passing argument here to parameter'x'.
{
printf("Passed Value of x: %d", x);
}