O'Reilly logo

Learn to Program with C by Noel Kalicharan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

CHAPTER 7

image

Functions

In this chapter, we will explain the following:

  • Why functions are important in programming
  • How to write functions
  • What happens when a function is called
  • Where functions are placed in a program
  • Some important concepts relating to functions using several examples

7.1 About Functions

So far, all our programs have consisted of a single function called main. However, we have made use of predefined C functions such as printf, scanf, strcpy, and fopen. When we run a program, it starts executing with the first statement in main and ends when it reaches the last statement.

As we have seen, it is possible to write reasonably useful ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required