Sunteți pe pagina 1din 13

DEPARTMENT OF TECHNICAL EDUCATION

Name : Murali Krishna Chintala
Designation : Lecturer in CME
Branch : Computer Engineering
Institute : SUVR & SR GPW, Ethamukkala
Year/Semester : III Semester
Subject Name : UNIX & C
Subject Code : CM – 304
Major Topic : Understand Modular Programming
Duration : 50 Min
Sub Topic : Function prototype
Teaching Aids : PPT, Animations

CM304.64 1
Objective

On completion of this period, you would be able

to
• Understand the purpose of function prototypes.

CM304.64 2
Recap

• Function calling types.

CM304.64 3
Function prototype

function.

• The number of arguments the function receives.

• Types of arguments.

• Order of the arguments.

CM304.64 4
Function prototype

Syntax
• Return_ type function_name(dt1,dt2..dtn);

function.

• dt1,dt2..dtn are the types of data fed as arguments.

CM304.64 5
Function prototype
Example:1

#include<stdio.h>
int big(int,int,int);/*function proto type*/
main()
{
int a,b,c;
scanf(“%d%d%d”,&a,&b,&c);
printf(“biggest is:%d”,big(a,b,c));
}

CM304.64 6
Function prototype
Contd..

int big(int x,int y,int z)

{
int max=x;
if(y>max)
max=y;
if(z>max)
max=z;
return(max);
}
CM304.64 7
Summary
At the end of the class, you have learnt about..

4. The order in which these arguments are expected

CM304.64 8
QUIZ
1. Function proto type tells the compiler..

c) Number of arguments the function receives

e) Types of arguments

CM304.64 9
QUIZ

1. Function proto type tells the compiler..

 Type of data returned by the function

 Number of arguments the function

 Types of arguments

CM304.64 10
QUIZ

2. Compiler uses function proto types to validate.

a) System calls

c) Function calls

e) Recursive calls

g) None

CM304.64 11
QUIZ
2. Compiler uses function proto types to validate.
 System calls

 Function calls

 Recursive calls

 None

CM304.64 12