C Function

A function is used to perform a specific task. Function is our logic. we can add our logic in a function.  function is used to perform to specific work.
or
function is our logic with many statements.

Types of C Function

we have two types of c Function :-
(i) Library function
(ii) User define function

Library function :->

Library function are the in-built in c programming Function.

Example :-  main(),printf(), scanf(),put().

Main():-

main function is a part of every program in c language.
Compiler always start to check our code from main.
So, main is the important part of our program.Thus the main function
is always the first line of code executed.

 

User defined function: –

c language also provide  us, user defined function.
user defined function always require prototype before we
start using it. prototype tell the compilers that we will use this function.

Advantage of user defined function :-
1. function provides reusability and break the large
code of segment into small code.it helps
the user to easy understand, maintain.
2. We can divide our workload using function.

syntax of function:-

return_type function_name(argument)
{
//statements
//statements
}

return_type :-  In return type can use any data type such as int, double, char,float, void ,short etc.

function name : you can give any name to the function function name should be meaning full.

next  




Follow Us

Contact Us

tutorialworldin@yahoo.com

Back to Top