UrbanPro

Learn C Language from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

What is the benefit of using enum to declare a constant?

Asked by Last Modified  

Follow 0
Answer

Please enter your answer

14yrs exp Math Computers Science English Hindi Teaching. Improvement In Scores Guaranteed Fee REFUND

ENUMS.. Can give numerical values for Sunday, Monday,... Easy to use in coding... Makes the program more readable/ understandable, than using 1,2,3.. Etc.
Comments

Experienced software professional, interested in teaching

Multiple benifits: 1. You can provide meaningful names for constant values and use the names to refer to the constant values. This increases the readability of the code and results in better understanding. 2. Better parameterization of the code. If you need to change the value, you don't need to make...
read more
Multiple benifits: 1. You can provide meaningful names for constant values and use the names to refer to the constant values. This increases the readability of the code and results in better understanding. 2. Better parameterization of the code. If you need to change the value, you don't need to make changes in multiple places. Just change the enum definition and your program is valid with new values. 3. enums help the programs by helping them make fewer mistakes. [for ex., usage of a wrong constant], missing to change the value in some places]These mistakes will not be syntactical and hence compiler will not catch. Just that program misbehaves. read less
Comments

Software Professional Trainer with 26+ years of Experience in Software Design and Development

Enum is group of related constants. it will improve the readability of the program. it will not improve the performance of the program. Enum TestingStatus { YetToStart = 0; InProgress=2; Completed=3 };
Comments

Programming Trainer

enum lets you bound the range of a variable.
Comments

Computer & Maths Professor

Using the enum keyword to define a constant can have several benefits. First, constants declared with enum are automatically generated by the compiler, thereby relieving the programmer of manually assigning unique values to each constant. Also, constants declared with enum tend to be more readable to...
read more
Using the enum keyword to define a constant can have several benefits. First, constants declared with enum are automatically generated by the compiler, thereby relieving the programmer of manually assigning unique values to each constant. Also, constants declared with enum tend to be more readable to the programmer, because there is usually an enumerated type identifier associated with the constant's definition. Additionally, enumerated constants can usually be inspected during a debugging session. This can be an enormous benefit, especially when the alternative is having to manually look up the constant's value in a header file. Unfortunately, using the enum method of declaring constants takes up slightly more memory space than using the#define method of declaring constants, because a memory location must be set up to store the constant. Here is an example of an enumerated constant used for tracking errors in your program: enum Error_Code { OUT_OF_MEMORY, INSUFFICIENT_DISK_SPACE, LOGIC_ERROR, FILE_NOT_FOUND }; read less
Comments

Oracle, Hindi, C++, C, MS Office, VBScript,JavaScript,Spoken English etc with 29 years of experience

An enumeration is a user-defined data type consists of integral constants and each integral constant is give a name. Keyword enum is used to defined enumerated data type. enum type_name{ value1, value2,...,valueN }; Here, type_name is the name of enumerated data type or tag. And value1, value2,....,valueN...
read more
An enumeration is a user-defined data type consists of integral constants and each integral constant is give a name. Keyword enum is used to defined enumerated data type. enum type_name{ value1, value2,...,valueN }; Here, type_name is the name of enumerated data type or tag. And value1, value2,....,valueN are values of type type_name. read less
Comments

Computer & Maths Professor

With the help of enum, you can declare multiple constants at once
Comments

View 5 more Answers

Related Questions

C machine independent Programming Language? C is portable . Means What?
It can work on various hardware configuration . C doesnt require mandatory or same set of hardware to run program. A program can written on one comp. And can run on other comp.(machine)
Shiva
Why is C programming language called C?
It was first known as New B as it was an improved version of the B programming language. As C comes next to B in the English alphabet, it was renamed C later before its release. C is the only programming...
Shiva
0 0
5
What is a stream?
Stream means flow... ofstream This data type represents the output file stream and is used to create files and to write information to files. ifstream This data type represents the input file stream and is used to read information from files
Nilam
Is a default case necessary in a switch statement?
NO, default is optional and you can omit it if there is no use of it.
My
how much time does it take to learn c language from basic to advance range
3 month and also depend in your skill to learning power...
Nithin

Now ask question in any of the 1000+ Categories, and get Answers from Tutors and Trainers on UrbanPro.com

Ask a Question

Related Lessons

Dynamic Memory Allocation in C using malloc()
#include <stdio.h>#include <conio.h>//#include <malloc.h> OR#include <stdlib.h>void main(){ int *ptr, i, n, sum = 0; printf("how many elements ? "); scanf("%d", &n);...

Operators in C
Operators in C Operator: An operator is a symbol that tells the compiler to perform certain mathematical or logical calculations. Operators are used in programs to manipulate data and variables. The...

Why we need to learn Programming languages?
Language is medium for communication. If two parties like to communicate or exchange the thoughts they must know a language. Language should be understandable by both the Parties. For example A wants to...

Some interview questions and answers for fresher level on Pointers
What is a void pointer? Void pointer is a special type of pointer which can reference or point to any data type. This is why it is also called as Generic Pointer. As a void pointer can point to...

Be prepared to get trained--init
Before starting the training,students must be mentally prepared for acceptance of new knowledge. Students must attend training with open minded forgetting the position they are working.This will help...
S

Smartnub Softsolutions

0 0
0

Recommended Articles

Lasya Infotech is a Hyderabad based IT training institute founded in 2016 by O Venkat. Believing in his innovation, passion and persistence and with a diverse blend of experience, he started his brainchild to deliver exemplary professional courses to aspiring candidates by honing their skills. Ever since the institute envisions...

Read full article >

Brilliant Academy is one of the reputed institutes for B.Tech tuition classes. This institute is specialised in delivering quality tuition classes for B.E, Engineering - all streams and Engineering diploma courses. Incorporated in 2012, Brillant Academy is a brainchild of Mr Jagadeesh. The main motto of the academy is to...

Read full article >

Whether it was the Internet Era of 90s or the Big Data Era of today, Information Technology (IT) has given birth to several lucrative career options for many. Though there will not be a “significant" increase in demand for IT professionals in 2014 as compared to 2013, a “steady” demand for IT professionals is rest assured...

Read full article >

Almost all of us, inside the pocket, bag or on the table have a mobile phone, out of which 90% of us have a smartphone. The technology is advancing rapidly. When it comes to mobile phones, people today want much more than just making phone calls and playing games on the go. People now want instant access to all their business...

Read full article >

Looking for C Language Classes?

Learn from the Best Tutors on UrbanPro

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you
X

Looking for C Language Classes?

The best tutors for C Language Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn C Language with the Best Tutors

The best Tutors for C Language Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more