Skip to main content Accessibility help
×
Hostname: page-component-6bb9c88b65-zjgpb Total loading time: 0 Render date: 2025-07-27T10:57:47.573Z Has data issue: false hasContentIssue false

13 - Function

Published online by Cambridge University Press:  17 July 2025

Subrata Saha
Affiliation:
Techno India Hooghly, West Bengal
Subhodip Mukherjee
Affiliation:
Techno India College of Technology, West Bengal
Get access

Summary

The basic principle to define a function is to divide a large program into some smaller modules so that a complicated task can be broken into simpler and more manageable form that can be handled easily. These smaller modules are used to accomplish a definite task.

Function is a self-contained block of statements that perform some specific job. In C language, we achieve the modular programming using function. Functions in C are categorized into two groups. They are Library function and User defined function. Library functions are defined within several header files as per individual category of the functions. We already discussed some library functions and some other will be discussed later. Though C supports a large number of library functions, but this is not sufficient. According to our requirement we need to define our own functions. These are called user defined function. In this chapter we will discuss how a user defined function can be defined and how it can be accessed, etc.

Basically, any C program is a collection of one or more functions. If it contains only one function, then it is the main function. In C program main function is a special function. Every C program starts its execution from main function and other functions are called from this function as well. Every C program must have a main function and more than one main function is not possible in a single program. However, a C program may contain more than one user defined function and there is no restriction on this.m

Information

Type
Chapter
Information
Publisher: Cambridge University Press
Print publication year: 2016

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)

Book purchase

Temporarily unavailable

Accessibility standard: Unknown

Accessibility compliance for the PDF of this book is currently unknown and may be updated in the future.

Save book to Kindle

To save this book to your Kindle, first ensure no-reply@cambridge-org.demo.remotlog.com is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about saving to your Kindle.

Note you can select to save to either the @free.kindle.com or @kindle.com variations. ‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi. ‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.

Find out more about the Kindle Personal Document Service.

Available formats
×

Save book to Dropbox

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Dropbox.

Available formats
×

Save book to Google Drive

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Google Drive.

Available formats
×