[Home]  [Edit this page]  [Recent Changes]  [Special Pages]  [Help
CFunction

(C) Function

A function is "a named sequence of statements that can be invoked/called given arguments and that might return a value. The type of the function includes the number and types of argument and the type of the value returned, if any" [1].

[return type] [function name]( [arguments] )
{
  [statements]
}


A function has a declaration and a definition. The compiler needs to have read the function declaration before this function is used. If the definition is nowhere provided, this results in a linking error.

Functions can also be  ?static. This means that it can only be called from its  ?unit/module.

static void sayHello()
{
  std::cout << "Hello" << std::endl;
}


Functions without a return type specified

You should always specify a return type.
 myFunction() /* NO! No return type! */


In earlier implementations of C, there was a default return type of type int

Standard functions

  1.  ?abort
  2.  ?abs
  3.  ?acos
  4.  ?asctime
  5.  ?asin
  6. assert
  7.  ?atan
  8.  ?atan2
  9.  ?atexit
  10.  ?atof
  11.  ?atoi
  12.  ?atol
  13.  ?bsearch
  14.  ?calloc
  15.  ?ceil
  16.  ?clearerr
  17.  ?clock
  18.  ?cos
  19.  ?cosh
  20.  ?ctime
  21.  ?difftime
  22.  ?div
  23.  ?exit
  24.  ?exp
  25.  ?fabs
  26. fclose
  27.  ?feof
  28.  ?ferror
  29.  ?fflush
  30.  ?fgetc
  31.  ?fgetpos
  32.  ?fgets
  33.  ?floor
  34.  ?fmod
  35. fopen
  36. fprintf
  37.  ?fputc
  38. fputs
  39.  ?fread
  40.  ?free
  41.  ?freopen
  42.  ?frexp
  43. fscanf
  44.  ?fseek
  45.  ?fsetpos
  46.  ?ftell
  47.  ?fwrite
  48.  ?getc
  49.  ?getchar
  50.  ?getenv
  51.  ?gets
  52.  ?gmtime
  53.  ?isalnum
  54.  ?isalpha
  55.  ?iscntrl
  56.  ?isdigit
  57.  ?isgraph
  58.  ?islower
  59.  ?isprint
  60.  ?ispunct
  61.  ?isspace
  62.  ?isupper
  63.  ?isxdigit
  64.  ?labs
  65.  ?ldexp
  66.  ?ldiv
  67.  ?localtime
  68.  ?log
  69.  ?log10
  70.  ?longjmp
  71. malloc
  72.  ?memchr
  73. memcmp
  74. memcpy
  75. memmove
  76.  ?memset
  77.  ?mktime
  78.  ?modf
  79.  ?perror
  80.  ?pow
  81. printf
  82.  ?putc
  83.  ?putchar
  84.  ?puts
  85.  ?qsort
  86.  ?raise
  87. rand
  88.  ?realloc
  89.  ?remove
  90.  ?rename
  91.  ?rewind
  92. scanf
  93.  ?setbuf
  94.  ?setjmp
  95.  ?setlocale
  96.  ?setvbuf
  97.  ?signal
  98.  ?sin
  99.  ?sinh
  100.  ?sprintf
  101.  ?sqrt
  102.  ?srand
  103.  ?sscanf
  104.  ?strcat
  105. strchr
  106.  ?strcmp
  107.  ?strcoll
  108.  ?strcpy
  109.  ?strcspn
  110.  ?strerror
  111.  ?strftime
  112.  ?strlen
  113.  ?strncat
  114.  ?strncmp
  115.  ?strncpy
  116.  ?strpbrk
  117.  ?strrchr
  118.  ?strspn
  119.  ?strstr
  120.  ?strtod
  121.  ?strtok
  122.  ?strtol
  123.  ?strtoul
  124.  ?strxfrm
  125.  ?system
  126.  ?tan
  127.  ?tanh
  128.  ?time
  129.  ?tmpfile
  130.  ?tmpnam
  131.  ?tolower
  132.  ?toupper
  133.  ?ungetc
  134.  ?va_arg
  135.  ?vfprintf
  136.  ?vprintf
  137.  ?vsprintf


'Function' links

References



last edited (May 11, 2007) by bilderbikkel, Number of views: 2580, Current Rev: 4 (Diff)

[Edit this page]  [Page history]  [What links here]  [Discuss this topic]  [Printer Friendly]  

Members

Username:

Password:


Register
Forgot Password?




Programmers Heaven - for .NET, Java, C/C++ and WEB Developers!
© 1996-2008 Community Networks Ltd. All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited. Violators of this policy may be subject to legal action. Please read Terms Of Use and Privacy Statement for more information. Development by Tore Nestenius at .NET Consultant - Synchron Data.