Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

C Why enums are used?

#include <stdio.h>

enum suit {
    club = 0,
    diamonds = 10,
    hearts = 20,
    spades = 3
} card;

int main() 
{
    card = club;
	printf("Size of enum variable = %d bytes", sizeof(card));	
	return 0;
}
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #C #Why #enums
ADD COMMENT
Topic
Name
5+6 =