1. Home
  2. Computing & Technology
  3. C / C++ / C#

C Tutorial - Lesson Six - About Functions

By , About.com Guide

1 of 6

Learn About Functions

We've briefly used functions before; strcpy() was used to assign a string. If you've used a spreadsheet worksheet function before then you'll have a good idea what a function is like. It's a block of code that can be called from anywhere in your application. It performs some calculation or process and then returns a value.

Every single example program you've seen so far is actually a function. It's called main() and it returns an integer. The difference is that it's called by the operating system when your application is loaded into RAM.

There are two types of functions. The ones that are provided with the compiler and the ones that you write. Let's look at the functions provided with the compiler.

Built In Functions

Ansi C specifies 15 include files that compiler writers must implement for the C standard library. They are listed below.
  • <assert.h> *Diagnostics
  • <ctype.h> *Character Class Tests
  • <errno.h> Error Codes Reported by Library Functions
  • <float.h> Floating-Point Limits
  • <limits.h> Implementation-defined Limits
  • <locale.h> Locale-specific Information
  • <math.h> *Mathematical Functions
  • <setjmp.h> Non-local Jumps
  • <signal.h> Signals
  • <stdarg.h> *Variable Argument Lists
  • <stddef.h> Definitions of General Use
  • <stdio.h> *Input and Output
  • <stdlib.h> *Utility functions
  • <string.h> *String functions
  • <time.h> *Time and Date functions
      * Are the ones I consider most useful.

      On the next Page : Learn how to call functions.

Explore C / C++ / C#
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. C / C++ / C#
  4. C
  5. C Tutorials
  6. C Tutorial - Lesson Six - About Functions>

©2009 About.com, a part of The New York Times Company.

All rights reserved.