What's the difference between
and
Enter two words to compare and contrast their definitions, origins, and synonyms to better understand how those words are related.

Enum vs Struct - What's the difference?

enum | struct |

In computing programming terms the difference between enum and struct

is that enum is an enumeration (set of named constants) while struct is a data structure, especially one that serves to group a number of fields (in contrast to an object-oriented class with methods) or one that is passed by value rather than by reference.

enum

English

{{examples-right, examples= enum colours { red, green, blue, white, black } }}

Noun

(en noun)
  • (computing, programming) An enumeration (set of named constants).
  • * 2007 , Robert Pickering, Foundations of F#
  • Enums allow you to define a type made up of a finite set of identifiers, with each identifier mapping to an integer.
  • * 2007 , Teresa Hennig, Rob Cooper, Geoffrey L Griffith, Armen Stein, Access 2007 VBA Programmer's Reference
  • The Access object model contains many enums that you can use in your applications.
  • * 2009 , Richard F Raposa, SCJP: Sun Certified Programmer for Java Platform (Exam CX-310-065)
  • A unique feature of enums is that when you switch on a variable of an enum type, you do not prefix the case statements...

    Anagrams

    *

    struct

    English

    Noun

    (en noun)
  • (computing, programming) A data structure, especially one that serves to group a number of fields (in contrast to an object-oriented class with methods) or one that is passed by value rather than by reference.
  • Synonyms

    * (in some contexts)

    Hyponyms

    * (in some contexts)