DataType in C

Advertisements

Prev Tutorial Next Tutorial

DataType in C Language

Data type is a keyword used to identify type of data. Data types are used for storing the input of the program into the main memory (RAM) of the computer by allocating sufficient amount of memory space in the main memory of the computer.

In other words data types are used for representing the input of the user in the main memory (RAM) of the computer.

In general every programming language is containing three categories of data types. They are

  • Fundamental or primitive data types
  • Derived data types
  • User defined data types
datatype images

Primitive data types

These are the data types whose variable can hold maximum one value at a time, in C language it can be achieve by int, float, double, char.

Example

int a;  //  valid
a = 10,20,30;  //  invalid

Derived data types

These data type are derived from fundamental data type. Variables of derived data type allow us to store multiple values of same type in one variable but never allows to store multiple values of different types. These are the data type whose variable can hold more than one value of similar type. In C language it can be achieve by array.

Example

int  a[] = {10,20,30};  // valid
int b[] = {100, 'A', "ABC"};   //  invalid

User defined data types

User defined data types related variables allows us to store multiple values either of same type or different type or both. This is a data type whose variable can hold more than one value of dissimilar type, in C language it is achieved by structure.

Syntax

struct emp
{
int id;
char ename[10];
float sal;
};

In C language, user defined data types can be developed by using struct, union, enum etc.


Prev Tutorial Next Tutorial

Google Advertisment

Buy This Ad Space @$20 per Month, Ad Size 600X200 Contact on: hitesh.xc@gmail.com or 9999595223

Magenet is best Adsense Alternative here we earn $2 for single link, Here we get links ads. Magenet

For Projects 9999595223

Google Advertisements


Buy Websites 9999595223

Buy College Projects with Documentation Contact on whatsapp 9999595223. Contact on: hitesh.xc@gmail.com or 9999595223 Try this Keyword C++ Programs

Advertisements