User defined function in c

Page 1

User Defined Function in C Tccicomputercoaching.com What is User Defined Function? A User Defined Function is a block of code developed by user to perform specific task. Using user Defined Function we can divide a complex problem into smaller modules. So we can decrease complexity and lengthy.

C allows programmer to define functions according to their need. These functions are known as user-defined functions. For example: Suppose, a program which includes addition, subtraction, division and multiplication of two numbers in same program. You can create user defined functions for each operation individually to solve this problem: For example, #include <stdio.h> #include <conio.h> Void add(int, int); // function prototype Void sub (int, int); // function prototype Void mul (int, int); // function prototype Void div (int, int); // function prototype void main () { inta,b; printf(“enter the value of a and b); scanf(“%d %d”,&a,&b); clrscr (); add (a,b); sub (a,b);


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.