Re: Help with a little C
- Posted by The AfterBeat <afterbeat at GEOCITIES.COM> Feb 12, 1999
- 474 views
Yep, basically, that's what it is.. The simplest way I can explain it is by saying that boolean G_CheckDemoStatus(void); is a function prototype. The format goes like this: ReturnType FunctionName(Parameters); Where ReturnType is the type of the return value (any C data types or types you define yourself). If this is omitted, then int is the default return type. A lot of programmers (such as me) still choose not to omit the return type and explicitly declare the return type as int, because it's easier to read (at least in my opinion). FunctionName is the name of the function, and Parameters contains the parameter list.. void means no parameters, otherwise, parameter lists are declared the same way as in Euphoria (heh... it's easier for me to explain when i do it like that).. If you use an ellipsis (...), then the compiler knows that the function is going to deal with an unlimited number of parameters, but when you do that, to keep your program compatible with the ANSI C standard, you have to have at least one fixed parameter.. To keep it simple, I won't explain why. It might be a little intimidating, but you'll get the hang of it (assuming you're learning C.. heheh).. Austin C. (aka The AfterBeat) "Boehme, Gabriel" wrote: > Grape Vine <chat_town at HOTMAIL.COM> wrote: > > > I need a little help with just what this line of code does > > > > boolean G_CheckDemoStatus (void); > > > > i know what boolean means in math but what does it do here??? > > > > Grape Vine > > "boolean", as it appears here in C, defines the data type for the value > returned from the function. We don't have to do this in Euphoria, so that's > probably why it threw you. > > If I recall my C class correctly, this is how C knows the format of the data > it's passing back from the function. Either that, or it helps the compiler > convert data from one type to another if the receiving variable is a > different type (or class, or whatever). As this is all from memory, I may be > somewhat wrong. But I think that's the gist of it. > > Hope this helps, > > Gabriel Boehme