Skip to main content

Enum in C Program

Enum in C Programming Language

In this post, We will learn about enumeration (enum) and its uses.

Introduction

An enumeration is a user-defined data type that consists of integral constants. To define an enumeration, the keyword enum is used. It is mainly used to assign names to integral constants, the names make a program easy to read and maintain.

Example:
 #include<stdio.h>   
 enum week{Mon, Tue, Wed, Thur, Fri, Sat, Sun};   
 int main()   
 {   
   enum week day;   
   day = Wed;   
   printf("%d",day);   
   return 0;   
 }   

Important Points about Enum

  • Two enum names can have the same value
  •  If we do not explicitly assign values to enum names, the compiler by default assigns values starting from 0
  • We can assign values to some name in any order
  • The value assigned to enum names must be some integral constant
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.


Comments

Popular posts from this blog

How Machine Learning (ML) Work

How Machine Learning (ML) Work In this post, We will learn how machine learning work. What is machine learning (ML) ? Machine learning is a study of model that compute use to progressively improve their performance on a specific task. What is Machine learning models ? Machine learning model contains a set of instruction or mathematical formula or in simple word it contain a piece of code in which we provide some data as input and model return some output. We learn more about model and how use a machine leaning model latter. How Machine Learning (ML) Work  ? This part we will understand with an example. Suppose want to have a simple application which will take a picture and banana or apple and application will tell us either it is banana or apple or picture is neither banana nor apple. To solve this problem first we provide a set of banana picture to our model and we will tell our model that this is a banana picture similarly we will provide a set of apple...

Arithmetic Expression Problem

Arithmetic Expression Problem In this post, We will share some arithmetic operation problems. Please solve it and your answer in comment section. Solution of all problem are available here  Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

HLL Infra Tech Services Ltd

HLL Infra Tech Services Ltd  Recruitment Company Name HITES Post Name Chief Engineer State India Salary Rs  32,900-58,000 Number of Vacancy 06 Eligibility Degree in Engineering Last Date 10-12-2018 Application Details Job Notification Apply Online TBD HLL Infra Tech Services Ltd Recruitment Government Jobs in  India Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

Install Adminer

ADMINER APACHE Adminer is a tool for managing content in databases. In this post, We learn how to install Adminer on ubuntu. Install Adminer To install Adminer run sudo apt install adminer Configuration  Copy the configuration to your config folder and enable it sudo cp /etc/adminer/apache.conf /etc/apache2/conf-available/adminer.conf  sudo a2enconf adminer Reload Apache systemctl reload apache2 Run Adminer Open your favorite browser and type localhost/adminer/ or  localhost/adminer.php/ Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.