Enumerated data types in c program


















That's what differentiates good programmers from great programmers. Course Index Explore Programiz. Popular Examples Create a simple calculator. Check prime number. Print the Fibonacci sequence. Check if a number is palindrome or not. Program to multiply matrix. Reference Materials iostream. Data Structures. Operating System. Computer Network. Compiler Design.

Computer Organization. Discrete Mathematics. Ethical Hacking. Computer Graphics. Software Engineering. Web Technology. Cyber Security. C Programming. Control System. Data Mining. Data Warehouse. Javatpoint Services JavaTpoint offers too many high quality services. In the above statement, we have declared the 's' variable of type status. Let's create a simple program of enum.

Following is an example of enum declaration. So as a result, 2 is printed. Interesting facts about initialization of enum. Two enum names can have same value. If we do not explicitly assign values to enum names, the compiler by default assigns values starting from 0.

For example, in the following C program, sunday gets value 0, monday gets 1, and so on. Skip to content. Change Language. Article Contributed By :. Easy Normal Medium Hard Expert. Writing code in comment? Please use ide. Load Comments. What's New. We use cookies to ensure you have the best browsing experience on our website.



0コメント

  • 1000 / 1000