next up previous contents index
Next: Function pointers (advanced) Up: Types Previous: Enumerated types   Contents   Index


The void type

The keyword void is used in two contexts: function declarations and pointers. The pointer type void* is a a `generic' pointer type: any pointer can be assigned to a void*, and a void* can be assigned to any pointer. In function definitions and declarations, it is used to indicate either that the function has no return value, or that it takes no arguments:

  
void f(int i) {
  /*  does something with i but doesn't return a value.
      (The function must not use the `return' keyword.)  */
}

int random_number(void) {
  /*  takes no arguments but returns a integer  */
}



CATAM admin 2010-02-23