Structs
can be used to define custom types, which are build using a combination of the
primitive types like int, string etc. For example we can define an Employee
Struct which can hold details of the employee id, name, address etc in
individual types like int, string etc.
Structs
are value types while classes are reference types, which means that every
instance of the Struct is completely independent and have their own set of
values. If a struct instance A is assigned to struct instance B then both A
& B have their own memory and have an independent set of value, hence any
change to instance A will not affect instance B.
The below example defines a simple Struct which contains an integer id and a string name representing an employee details.