Introduction to functions in C
Syntax
Void functions
Call by Value and call by
reference
Swap example
Reference parameter technique
Const
Bigger pointer example
HOME
|
|
void is a type
formalized in ANSI C which means "nothing". To indicate that a function does
not return anything, use void as the return type. Also, by convention, a
pointer
which does not point to any particular type is declared as void*. Sometimes
void* is used to force two bodies of code to not depend on each other where
void* translates roughly to "this points to something, but I'm not telling
you (the client) the type of the
pointee exactly because you do not really need to know." If a function does
not take any parameters, its parameter list is empty, or it can contain the
keyword void but that style
is now out of favor.
void TakesAnIntAndReturnsNothing(int anInt);
int TakesNothingAndReturnsAnInt();
int TakesNothingAndReturnsAnInt(void); // equivalent syntax for above
Want To Know more with
Video ???
Contact for more learning: webmaster@freehost7com
|
|
|