Sign in to follow this  
gabrielzheaven

SDL game

Recommended Posts

what is meant by bool init()??
i understand all the code that is contained in it..
i suppose bool is boolean which can take only two values i.e. truth or false.....but what is bool init()??...i am confused..

Share this post


Link to post
Share on other sites
[quote name='Michaelangelo' timestamp='1298364822' post='4777446']
what is meant by bool init()??
i understand all the code that is contained in it..
i suppose bool is boolean which can take only two values i.e. truth or false.....but what is bool init()??...i am confused..
[/quote]

That looks like a function prototype, in this case bool specifies that the function init() will return a bool type. Which mean you
can do things like:
[code]
if(!init())
{
exit(1);
}


[/code]

Which will terminate the program if init() returns false.

Share this post


Link to post
Share on other sites
thanks a lot..
[quote name='prh99' timestamp='1298365470' post='4777452']
[quote name='Michaelangelo' timestamp='1298364822' post='4777446']
what is meant by bool init()??
i understand all the code that is contained in it..
i suppose bool is boolean which can take only two values i.e. truth or false.....but what is bool init()??...i am confused..
[/quote]

That looks like a function prototype, in this case bool specifies that the function init() will return a bool type. Which mean you
can do things like:
[code]
if(!init())
{
exit(1);
}


[/code]

Which will terminate the program if init() returns false.
[/quote]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this