Passing enumerate type paramenters in and out of function
Hi All,
I just start learning to program in C for awhile.
I have read several C programming books and websites(also look at their source code) but so far I haven't seen people(even C experts) using
a pointer which points to a enummate
type for function parameters. They are often using pointer to int, float or char as function parameters.
Could anyone explain why in C people try to avoid
(or eliminate)to passing a pointer of enumerate type in and out of function?
If my a function requires to pass in and out more than one parameters of enumerate type
what should I do?
For example code segment below:
/*========Data structures===========*/
typedef enum {ON, OFF) Switch;
typedef enum {LOW, HI, NEUTRAL} Speed;
typedef enum {RUN, STOP, STANBY} Mode;
/*============================================*
* An example of passsing enumType parameters in * and out of function
*==============================================*/
Switch FUN(Speed *Speed_Ptr, /*in and out*/
Mode *Mode_Ptr, /*in and out*/
int RangeLimit /*in*/
)
{
...do some processing/computing here
and send data back to function calls
by return value and pointers.
...
}
Is this valid and good code practice in C???
Especially to mission critical code development.
I really appreciate for your help.
Thanx!