Enum Conversions - C Data Type

C examples for Data Type:enum

Introduction

You can convert an enumerated constant to an integer.

An integer can also be converted back into an enum variable.

int i = RED;
enum color c = i;

To suppress this warning an explicit type cast can be used.

enum color c = (enum color)i;

Related Tutorials