Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Ā
Functions and return type
1.
2. Disclaimer: This presentation is prepared by trainees of
baabtra as a part of mentoring program. This is not official
document of baabtra āMentoring Partner
Baabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt .
Ltd
4. ā¢ one of the strengths of c language is c
functions,they are easy to define and use
ā¢ C function can be classified in to two
catagories
ā¢ 1 library function :printf and scanf
ā¢ 2 user defind function: main
5. Need for user defined function
ā¢ Main is specially recoganized function in
c,every program must have a main function to
indicate where the program has to be
execution
ā¢ If a program condain only main function
number of problem,testing and maintaining
become difficult
6. ā¢ Program is divided in to functional part
,which is independently coded and later
combined in to a single unit
ā¢ This independently coded programs are
called sub programs are referred as
function
8. Definition of function
ā¢ function name
ā¢ Function type
ā¢ List of parameters
ā¢ Local variable declaration
ā¢ Function statement
ā¢ Return statement
9. Function_type function _name(parameter list)
{
local variable declaration;
executable statement1;
executable statement2;
ā¦ā¦ā¦ā¦ā¦ā¦ā¦ā¦ā¦ā¦ā¦ā¦ā¦..
return statement;
}
10. Function header
ā¢ Type specifies type of value that expected to
return eg:int,float
ā¢ Void:function not return anything
ā¢ name is valid c identifier
ā¢ Same rule for other variable name in c
11. Formal parameter list
ā¢ Input data to the function and carry out the
specified task
ā¢ Also used to send values to the calling
programs
ā¢ also known as arguments
12. Function body
ā¢ Float mul ( float flt_ x ,float flt_ y)
{
float result; /*local variable*/
result=flt_x*flt_y; /*compute the
mul*/
return (result);
}
17. ā¢ Declaration placed two places in program
1. Above all the function including main
2. Inside a function definition
18. Contact Us
Emarald Mall (Big Bazar Building)
Mavoor Road, Kozhikode,
Kerala, India.
Ph: + 91 ā 495 40 25 550
NC Complex, Near Bus Stand
Mukkam, Kozhikode,
Kerala, India.
Ph: + 91 ā 495 40 25 550
Start up Village
Eranakulam,
Kerala, India.
Email: info@baabtra.com