Skip to content

Instantly share code, notes, and snippets.

@marcoscastro
Last active January 1, 2016 08:49
Show Gist options
  • Save marcoscastro/8120330 to your computer and use it in GitHub Desktop.
Save marcoscastro/8120330 to your computer and use it in GitHub Desktop.
Exemplo do uso de enumeração em C
#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