This document explains the concept of functions in programming, detailing their purpose, declaration, definition, and calling methods. Functions allow programmers to reuse code and organize large programs into manageable modules based on functionality. It also describes the four types of functions based on their arguments and return types.
Functions are defined for specific tasks, allowing modular code reuse. Key aspects include declaration, definition, and calling methods. Types: with/without arguments and return values.
Visit external links for further learning on functions in C, including articles and social media platforms for programming insights.
• Function isa set of statement which is designed to
perform some specific task. Function gives functionality
to programmer to use one module(task) for more times
rather then write same code again and again. By using
Function we can divide the large program to many
separate modules based on their functionality.
3.
I ) FunctionDeclaration : In this area we declare the prototype and number
of argument required for function.
Syntax : return_type function_name (argument1,argument2.....)
eg : int div(int , int) { }
1 - int is a return type of function.
2 - div is a name for function.
3 - two int are arguments required to call the function.
4.
II ) FunctionDefinition : In this area we write the actual code of function
required to perform desired task.
Syntax : return_type function_name (list of argument with data types)
{ code of function ; return; }
5.
III ) FunctionCalling : In this part we call the function and pass the argument
for execution of function.
Syntax : function_name (arguments...)
6.
Four Types ofFunction :
i ) With argument and return type.
ii ) With argument and no return type.
iii ) No argument and return type.
iv ) No argument and no return type.
7.
Learn more aboutthat visit
http://www.programmingsguru.com/
article/function-in-c-language-27