Return type of function pointers to enum in c programming

Function returning pointer to enum in c programming language 


typedef enum color{a,b,c,d,e}co;
enum color eee(){
    static co x;
    x=b+c/2;
    return x;
}
void main(){
    int num;
    num=eee();
    clrscr();
    printf("%#d",num);
    getch();
}

Output:2


One more example:

enum color display();
void main(){
int c;
c=display();
printf("%d",c);
getch();
}
typedef enum color{
black,blue,red,green
}symbol;
symbol display(){
symbol x=black+green;
return x;
}

Output: 3
Post a Comment