Void

From Game Editor

Revision as of 18:42, 25 November 2009 by Asmodeus (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)
Jump to: navigation, search

void is a state that a function takes. If a function were to take no arguments then its contents would be void.

int
ReturnXY(void)
{
    return(x*y);
} 

This is a nonspecific way of returning a variable using x and y which are global. One would use void if the function is meant as a start up or deals with globally accessible variables. Functions can also be void. Void functions do not have a return value, as the value is void.

void
ChangePos(int x, int move)
{
    actor.x+=move;
}

This takes two ints and moves actor accordingly, but the function does not return a value.

Retrieved from "http://game-editor.com/Void"