Follow our Telegram channel to get notified instantly whenever new books are published.
C Programming Learn To Code – Sisir Kumar Jena

The above example is just an analogy to understand what a function is and how we are going to write it in C code. But, the actual syntax may slightly differ as we will discuss in a later section. After completing this chapter, readers will able to: Write functions for any given problem and describe the need for using a function. Define and differentiate the different categories of functions available in C. Explain the components of a function and how they work.
Know what a recursive function is and how to write one. Know all the different kinds of storage classes available in C. 9.2 The Need for Functions There are several uses of a function. We will take an example to show you why a function is needed. Suppose you are a carpenter and you build different types of wooden furniture. One day you receive an order to cut 10,000 pieces of wood in a zigzag manner, as shown in Figure 9.3.
Assume that no cutting machine has yet been developed to cut a piece of wood in a zigzag pattern. As the order is significant, and you must finish it on time, you need a cutter for this work. So, you decide to build a cutting machine. Your problem is solved, and you have a machine that can be used in the future for the same type of work.
Figure 9.3 Woodcutting in a zigzag pattern. What do we learn from the above example? A machine was developed that performs a specific task. It can be reused for the same type of work. It takes a piece of wood as input and generates two pieces of wood in a zigzag pattern. Here, the machine is a function designed to solve a specific problem, and it can be reused any number of times. Similarly, during our program development, we can create some functions for solving a specific task, and then use that function several times throughout our code.
We have already used several predefined functions like printf() and scanf() for console I/O purposes. We have used these functions in every program. In fact, whatever program we have written till now contains at least one function, i.e., the main() function. That means some functions were there already as predefined functions; some functions we wrote for our purposes are called user-defined functions.
Let us think in another way. Suppose you have a large task to do. The usual procedure is to divide the task into smaller tasks, solve each one separately, and combine them to solve the bigger problem. This process is called modular programming, and modular programming employs the concept of functions. After we divide the whole task into subproblems, each subproblem can be implemented with a function. Combining the result of all functions, we can solve a bigger problem. Consider the problem of designing a calculator.
6000 Broken Sound Parkway NW, Suite 300, Boca Raton, FL 33487-2742 and by CRC Press 2 Park Square, Milton Park, Abingdon, Oxon, OX14 4RN CRC Press is an imprint of Taylor & Francis Group, LLC © 2022 Sisir Kumar Jena Reasonable efforts have been made to publish reliable data and information, but the author and publisher cannot assume responsibility for the validity of all materials or the consequences of their use.
The authors and publishers have attempted to trace the copyright holders of all material reproduced in this publication and apologize to copyright holders if permission to publish in this form has not been obtained. If any copyright material has not been acknowledged please write and let us know so we may rectify in any future reprint. Except as permitted under U.S. Copyright Law, no part of this book may be reprinted, reproduced, transmitted, or utilized in any form by any electronic, mechanical, or other means, now known or hereafter invented, including photocopying, microfilming, and recording, or in any information storage or retrieval system, without written permission from the publishers.
For permission to photocopy or use material electronically from this work, access www.copyright.com or contact the Copyright Clearance Center, Inc. (CCC), 222 Rosewood Drive, Danvers, MA 01923, 978-750-8400. For works that are not available on CCC please contact [email protected] Trademark notice: Product or corporate names may be trademarks or registered trademarks and are used only for identification and explanation without intent to infringe. Library of Congress Cataloging‑in‑Publication Data Names: Jena, Sisir Kumar, author.
Title: C programming : learn to code / Sisr Kumar Jena. Description: First edition. | Boca Raton, FL : Chapman & Hall/CRC Press, [2022] | Includes bibliographical references and index. | Summary: “The C programming language is a popular language in industries as well as academics. Since its invention and standardized as ANSI C, several other standards known as C99, C11, and C17 were published with new features in subsequent years.
This book covers all the traits of ANSI C and includes new features present in other standards. The content of this book helps a beginner to learn the fundamental concept of the C language. The book contains a step-by-step explanation of every program that allows a learner to understand the syntax and builds a foundation to write similar programs.
This is a short excerpt from the opening of “” by Unknown, quoted for review and introduction purposes. All rights belong to the copyright holders.
Book Information
- Unique ID: 9c769424cdfd91dc
- File Extension: .pdf
- File Size: 48,505,105 bytes (46.258 MB)
- Title: –
- Author: Unknown
- ISBN: 9781032036250, 9781032036274, 9781003188254
- Pages: 631
- Language: English (en)
Reading & Word Statistics
- Estimated Reading Time: 473.54 minutes
- Total Words: 94,708
- Total Characters: 556,341
- Average Words per Page: 150.09
- Average Characters per Page: 881.68
Most Frequent Words
program (935), number (742), printf (736), figure (672), function (592), int (528), write (449), array (407), output (406), main (396), file (381), memory (373), value (346), variable (326), using (316), include (303), code (295), structure (291), void (287), example (282), enter (276), two (268), pointer (265), stdio (264), string (256), line (253), numbers (250), data (243), functions (241), shown (223), type (222), programming (214), use (197), computer (195), following (194), statement (188), name (188), scanf (184), first (183), operator (183), shows (178), used (177), elements (174), binary (171), one (167), address (161), character (159), language (157), return (147), system (146), decimal (143), loop (139), need (137), find (136), integer (133), different (133), print (132), read (130), syntax (129), also (129), let (128), compiler (127), declaration (127), operators (127), input (126), variables (126), size (126), types (120), algorithm (119), statements (116), store (113), three (110), user (109), equivalent (108), given (108), representation (106), learn (105), process (105), case (104), bits (104), problem (103), allocation (103), section (103), take (102), execution (102), called (100), element (100), between (99), explain (96), flowchart (95), concept (94), inside (94), step (93), see (90), condition (90), questions (87), arguments (87), pointers (87), run (86), present (84).
