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

Can I just do something like the following?

Foo testFunc()
    return Foo.BAR;

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

About Nilesh Raut

I am Nilesh,3+ years Exp of SEO, content writing, and keyword research. Also rocks it as a software dev with skills in OS, web dev, Flask, Python, C++, data structures, and algorithms. 3 on Leetcode, 5*on Hackerrank more platform.

Nilesh Raut Changed status to publish July 20, 2023