What are Data Structures in C and How to use them?
Data Structures in C are used to store data in an organised and efficient manner. The C Programming language has many data structures like an array, stack, queue, linked list, tree, etc. A programmer selects an appropriate data structure and uses it according to their convenience.
Let us look into some of these data structures:
ARRAY
An Array is a sequential collection of elements, of the same data type. They are stored sequentially in memory. An Array is a data structure that holds a similar type of elements. The array elements are not treated as objects in c like they are in java.
Imagine you are at a musical instrument store and I tell you to arrange all the keyboards under the brand Casio at one place one above the other. This sequential collection of records is called an Array. An array is a sequential collection of elements of the same data type. In our example above, Casio is the data type and all the keyboards you collected are of the brand Casio. All the elements in an array are addressed by a common name.
There are two types of arrays:
- Single dimensional array
- Multidimensional array
The syntax for one-dimensional Arrays:
data_type array_name[array_size];
For more information click here...
No comments: