FidoNet Echomail Archive
c_echo

<<< Previous Index Next >>>

From: TLewis
To: All
Date: 2005-01-14 14:46:16
Subject: [C] Passing an enumerated data value

From: TLewis{at}mcleodhealth.org

I want to pass an enumerated data type to a function.  I have code below
that works, but I want to know if it is "proper" coding.  I tried
using "ENUM" in my function arguments, but that does not work.

Thanks,
Tim

#include <stdio.h>
void ShowPosition(int);

enum POSITION{TOP,BOTTOM};

main() {
printf("\nMain routine");

ShowPosition(TOP);

}

void ShowPosition(int POSITION) {

if (POSITION == TOP)
    printf("\nPostion is top");
if (POSITION == BOTTOM)
    printf("\nPosition is bottom");
}

--- BBBS/LiI v4.01 Flag-5
 * Origin: Prism's_Point (1:261/38.1)
SEEN-BY: 633/267 270
@PATH: 261/38 123/500 106/2000 633/267


<<< Previous Index Next >>>