LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   function definition query (https://www.linuxquestions.org/questions/programming-9/function-definition-query-436333/)

slzckboy 04-18-2006 06:36 AM

function definition query
 
sorry for the vague title..

my question is this.
I am using the libxml API and I have come accross something that I need some help understanding.

if a function if defined as
Code:

return_type somefunction(parm1,par2...)
{

variabletype variable1;
...
variabletype varibalen;
int option;    /*a combination of predefined options */
}

and the available options are declared as
Code:

enum the_options{
OPT1 1,OPT2 30,OPT3 50}.

then do I just or them together,i.e option=OPT1|OPT2|OPT3 if I want to define more than one of the options??

Also what would the code look like then that read OPT1|OPT2|OPT3???

Thanks in advance.

jim mcnamara 04-18-2006 08:29 AM

It's interesting that int options is not declared as an enum datatype, but the enum does not have a zero value. enums default to integer.

Code:

int options=OPT1|OPT2|OPT3;


All times are GMT -5. The time now is 10:12 AM.