1.

What are user-defined functions? Explain with example.

Answer»

User-defined Functions: This feature allows you to define functions within a program, which you can call whenever you need them. While running the program (FUNC) statement can save space as well as time, as a complex calculation can be defined with a short name and called up by its name where needed.
Defining a Function

main()
{
printf (“I am in function main \n”);
India();
printf (“I am finally back in function main \n”);
}
India()
{
printf (“I am in India \n”);
Delhi();
printf (“I am back in India \n”);
1
Delhi();
{
printf (“I am in Delhi \n”);
Bombay();
}
Bombay()
{
printf (“I am in Bombay”);
}

Output:
I am in function main
I am in India
I am in Delhi
I am in Bombay
I am back in India
I am finally back in function main



Discussion

No Comment Found