Using Functions in C Programming

1.	Functions
2.	Types of Functions :
       o	Built In Functions
       o	User Defined Functions
3.	Function Call By Passing Value
4.	Function Call By Returning Value
5.	Function Call By Passing and Returning Value
6.	Advantages
7.	Recursion (Recursive Function)

Functions in C :
The function is a self contained block of statements which performs a coherent task of a same kind.

C program does not execute the functions directly. It is required to invoke or call that functions. When a function is called in a program then program control goes to the function body. Then, it executes the statements which are involved in a function body. Therefore, it is possible to call fuction whenever we want to process that functions statements.

Types of Functions :

There are 2(two) types of functions as:
1. Built in Functions
2. User Defined Functions

1. Built in Functions :
These functions are also called as ‘library functions’. These functions are provided by system. These functions are stored in library files. e.g.
• scanf()
• printf()
• strcpy
• strlwr
• strcmp
• strlen
• strcat

2. User Defined Functions :
The functions which are created by user for program are known as ‘User defined functions’.


void main()
	// Function prototype
	// Function Call
// Function definition

Program :

/*  Program to demonstrate function.
Creation Date : 23 Nov 2010 11:31:20 AM
Author : [Technowell, Sangli] */

#include <stdio.h>
#include <conio.h>

void add()
	int a, b, c;
	printf("\n Enter Any 2 Numbers : ");
	scanf("%d %d",&a,&b);
	c = a + b;
	printf("\n Addition is : %d",c);

int main(void)
	void add();
	return 0;

Output :

 Enter Any 2 Numbers : 23 6
 Addition is : 29_

Leave A Comment

Your email address will not be published. Required fields are marked *