0

If I have something like the following in a header file, how do I declare a function that returns an enum of type Foo? functions can return enumeration constants in c

enum Foo
{
   BAR,
   BAZ
};

Can I just do something like the following?

Foo testFunc()
{
    return Foo.BAR;
}

Or do I need to use typedefs or pointers or something?

Nilesh Raut Changed status to publish July 20, 2023