





Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!






Function are classified in two types:
The function which are already written and are provide as a part of language are called library function
Printf(),scanf(),getch(),clrscr() etc
the function which are written by programmer for sum specific purpose other than library function is called udf
The general form of a function definition in C programming language is as follows – return type function name (parameter list) { Body of the function }
A function definition in C programming consists of a function header and a function body. Here are all the parts of a function −
Function Declarations A function declaration tells the compiler about a function name and how to call the function. The actual body of the function can be defined separately. A function declaration has the following parts – return type function name (parameter list); function declaration consist of:
Calling a Function While creating a C function, you give a definition of what the function has to do. To use a function, you will have to call that function to perform the defined task. When a program calls a function, the program control is transferred to the called function. A called function performs a defined task and when its return statement is executed or when its function-ending closing brace is reached, it returns the program control back to the main program. To call a function, you simply need to pass the required parameters along with the function name, and if the function returns a value, then you can store the returned value.
/* Nikhil pandey
if (num1 > num2) result = num1; else result = num2;
return result; }
Function Arguments
This method copies the actual value of an argument into the formal parameter of the function. In this case, changes made to the parameter inside the function have no effect on the argument.
This method copies the address of an argument into the formal parameter. Inside the function, the address is used to access the actual argument used in the call. This means that changes made to the parameter affect the argument.
Function prototype
Category of UDF