Last active
January 1, 2016 08:49
-
-
Save marcoscastro/8120330 to your computer and use it in GitHub Desktop.
Exemplo do uso de enumeração em C
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
enum cores{Azul, Branco, Vermelho}; | |
int main() | |
{ | |
// declaração de uma variável enum | |
enum cores cor; | |
// atribui valor Vermelho a variável cor | |
cor = Vermelho; | |
// imprime o valor 2 | |
printf("Valor: %d\n", cor); | |
// teste... | |
if(cor == Vermelho) | |
printf("Cor Vermelho\n"); | |
else | |
printf("Cor não é Vermelho\n"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment