Composite Type: Set and Strings Types
Explore composite data types in programming by learning how sets store unique unordered values and how strings represent arrays of characters. Understand the use of enumerations to define specific value sets for variables, and gain practical knowledge on handling these types effectively.
We'll cover the following...
Composite types
Sometimes, we have other reasons for storing unique values. We might want to represent what in mathematics is known as a finite set. For that, we have the set type.
Set and strings types
The set type
A set is a composite type that stores unique values without any order. Because this type is unordered, we can’t retrieve items from it with an index. This is usually not a problem because this type is often used to test for membership. You might, for example, have two sets with some values in them and would like to know which ...