You are here

Data structures in C

Data structures in C are an inevitable part of programs. Computer programs frequently process data, so we require efficient ways in which we can access or manipulate data. Some applications may require modification of data frequently, and in others, new data is continuously added or deleted. So we need efficient ways of accessing data to act on it and build efficient applications.

Array data structure

The array data structure has the advantage of accessing any of its elements in constant time. But adding an element at the beginning or somewhere in an array is a costly operation as we have to shift other elements. It's useful when the size of the data is fixed. We have other data structures, each offering unique advantages. We can choose which one to use in our program according to our requirements once we are familiar with different of them. Some algorithms also use a particular data structure in their implementation. Some other data structures are strings, linked lists, stack, queues, trees. Each of these has further types.

Operations on data

For a given data, we may wish to traverse it, search it, insert or delete data. We perform these operations on different data structures by implementing C programs.