[Home]
[Edit this page]
[Recent Changes]
[Special Pages]
[Help]
CFunction
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.
In earlier implementations of C, there was a default return type of type int
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
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
- ?abort
- ?abs
- ?acos
- ?asctime
- ?asin
- assert
- ?atan
- ?atan2
- ?atexit
- ?atof
- ?atoi
- ?atol
- ?bsearch
- ?calloc
- ?ceil
- ?clearerr
- ?clock
- ?cos
- ?cosh
- ?ctime
- ?difftime
- ?div
- ?exit
- ?exp
- ?fabs
- fclose
- ?feof
- ?ferror
- ?fflush
- ?fgetc
- ?fgetpos
- ?fgets
- ?floor
- ?fmod
- fopen
- fprintf
- ?fputc
- fputs
- ?fread
- ?free
- ?freopen
- ?frexp
- fscanf
- ?fseek
- ?fsetpos
- ?ftell
- ?fwrite
- ?getc
- ?getchar
- ?getenv
- ?gets
- ?gmtime
- ?isalnum
- ?isalpha
- ?iscntrl
- ?isdigit
- ?isgraph
- ?islower
- ?isprint
- ?ispunct
- ?isspace
- ?isupper
- ?isxdigit
- ?labs
- ?ldexp
- ?ldiv
- ?localtime
- ?log
- ?log10
- ?longjmp
- malloc
- ?memchr
- memcmp
- memcpy
- memmove
- ?memset
- ?mktime
- ?modf
- ?perror
- ?pow
- printf
- ?putc
- ?putchar
- ?puts
- ?qsort
- ?raise
- rand
- ?realloc
- ?remove
- ?rename
- ?rewind
- scanf
- ?setbuf
- ?setjmp
- ?setlocale
- ?setvbuf
- ?signal
- ?sin
- ?sinh
- ?sprintf
- ?sqrt
- ?srand
- ?sscanf
- ?strcat
- strchr
- ?strcmp
- ?strcoll
- ?strcpy
- ?strcspn
- ?strerror
- ?strftime
- ?strlen
- ?strncat
- ?strncmp
- ?strncpy
- ?strpbrk
- ?strrchr
- ?strspn
- ?strstr
- ?strtod
- ?strtok
- ?strtol
- ?strtoul
- ?strxfrm
- ?system
- ?tan
- ?tanh
- ?time
- ?tmpfile
- ?tmpnam
- ?tolower
- ?toupper
- ?ungetc
- ?va_arg
- ?vfprintf
- ?vprintf
- ?vsprintf
'Function' links
References
- 1) Bjarne Stroustrup's C++ Glossary. http://www.research.att.com/~bs/glossary.html
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
