Data Structure Algorithms with C Language
About Lesson

What is Data in program?

Data in the program can be stored by developer, can be accepted from the user or it can be generated from an operation dynamically (i.e. run time).  The way of storing and accessing data in the program can be done in many ways.  We know, variable is a basic unit of storage of data in a program.  We also know, we can use Array concept (data structure) to store multiple variables of same data type.

 

What is a Data Structure?

Data Structures allows you to organize the data of program, in such a way that enables you to store collections of data, maintain relationship between data elements and perform operations on them and access the stored data in an efficient manner.  These are not related to any particular programming language but defined in computer science in the form of Algorithms.

 

Difference between datatype and Data Structure

Datatype is basically a keyword of the language that denotes the kind of data that a data element like a variable can deal with in the program.  Data Structure is specification of arrangement of collection of data and operations required to manage the data.

Data type in any language is basically a keyword that is used to specify the kind of data that a data element can hold. 

The data type in a language determines

  1. Memory required for the data elements
  2. Kind of data that the element can hold
  3. Range or domain of values that data element can hold
  4. Type of operations supported by the element

 

Every language provides its own set keywords for data types.  For example, there are 4 basic data types in C language i.e. int, float, double and char.  We can also observe each data type specifies that characteristics of the data and operations that can be performed on the data.

The data types like int, float etc are providing by the programming languages.  Those languages also allow us to define our own data types like structures and classes which are known as user-defined data types. 

For example we can create a structure by combining many variables of different data types and then use the structure to declare variables

struct point{

int x;

int y;

}

 

point var1,var2;

You cannot copy content of this page