Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 6

C PROGRAMMING

BY MOHAMMED TAJUDDIN
C PROGRAMMING
FUNCTIONS :
Function means self contained block of statements which can perform
perticular task.
Fucnctions are two types
1)Builtin functions or Library functions
Ex : printf, scanf
2)user defined functions
thease are defined by user(program developer)
C PROGRAMMING
Implimentation of user defined functions :
steps :
1)function declaration or prototype
2)function definition
3)function call
user defined functions is used to avoid code repitition and code
reusability.
function declaration or prototype
syntax :
<return type> <function name> (arguments);
Ex : void cube ();
fuction definition
syntax :
<return type> <fuction name> (arguments)
Ex : void cube()
fuction call : syntax
<function name> (arguments);
C PROGRAMMING
#include<stdio.h>
int cube(int);
void main(){
int res;
res=cube(10);
printf(“%d”,res);}
int cube(int a){
return (a*a*a);}
C PROGRAMMING
#include<stdio.h>
int add(int,int);
int main(){
int res;
res=add(10,20);
printf(“%d”,res);}
int add(int a,int b){
return(a+b);}

You might also like