I want to use enum as function return type or as a argument. But when I give it as is, it’s giving error message. But if I typedef the same, it’s working fine.
#include <stdio.h>
enum // if *typedef enum* is used instead, it's working fine
{
_false,
_true,
} bool;
bool func1(bool );
int main()
{
printf("Return Value = %d\n\n", func1(_true));
return 0;
}
bool func1(bool status)
{
return status;
}
Please help me understand this. Thank you.
You are not making a new type
bool, instead you are declaring a variable namedbool.