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

How can I try to remember the coding in C language?
One shouldn't try to remember the coding. The right approach is to understand the logical solution to the problem.
Chinmayee
0 0
5
Is it valid to address one element beyond the end of an array?
No, array is a fixed size memory allocation for variables. It is illegal to access elements beyond the allocated space.
Shivani
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
How do you list a file's date and time?
The C date and time operations are defined in the time.h header file time_t current_time; char* c_time_string; /* Obtain current time. */ current_time = time(NULL);
Neelima
0 0
6
how to calculate address of n dimensional matrix
An n dimensional matrix can be of any dimension. Adding a dimension is adding one more index number (to access the element). In 1-D array you the elements are linearly arranged and can be addressed as...
Rupendra

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

Ask a Question

Related Lessons


Do You Know How Is Size Of Structure Defined?
Size of the structure is defined based on multiplies of bigger data type member in the structure. Example: If a structure contains integer, char, short data type, then size of the Structure will be multiples...

C Language
To get help in C window (for keywords, functions) press Alt +F1.To delete a single line , use the shortcut key CTRL +Y.If you got error about the path when you execute a C pgm, check the Options menu =>Directories.
T

Thilagam S.

0 0
0

Array vs Linked List
Array Linked List Accessing element is easy. Accessing element is difficult compare to Array. Easy to use. Difficult to use. Memory is Fixed size. Memory is variable size. If...

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);...

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