About Me

Hello there! Before talking about qualifications and professional abilities, I would like to introduce myself. I am a Yuvraj Basnet and professional software developer and have been working in this field for 3 long years. I have finished my graduation from The University of Delhi on Computer Science Engineering I considered myself a reasonably experienced programmer with a particular interest in the human side of software development, computers are fascinating machine, but they're mostly reflection of the people using them. In the art of software development, studying code isn't enough; you have to study the people behind the software, too.


In the previous tutorial you learn variable and tokens now 
In this tutorial, you will learn about data types in C programming.

                                     DATA TYPES  

A data-type in C programming is a set of values and is determined to act on those values. C provides various types of data-types which allow the programmer to select the appropriate type for the variable to set its value.
   The types in C can be classified as follows:  

C Data Types are used to:
  • Identify the type of a variable when it declared.
  • Identify the type of the return value of a function.

  • 1)Primary data type.
  • 2)Derived data type.
  • 3)User defined data type.

1) PRIMARY DATA TYPE (fundamental type)-

 The basic (fundamental) data types provided by c++ are integral, floating point and void data type. Among these data types, the integral and floating-point data types can be preceded by several type modifiers. These modifiers (also known as type qualifiers) are the keywords that alter either size or range or both of the data types.

A) Integer data type-

Integers are whole numbers that can have both positive and negative values but no decimal values. Example: 0, -5, 10.

B) Float data type-

Floating type variables can hold real numbers such as: 2.34, -9.382, 5.0 etc. You can declare a floating point variable in C by using either float or double keyword. For example:

float accountBalance;
double bookPrice;

C) Char data type-

Keyword char is used for declaring character type variables. For example:
char test = 'h';
Here, test is a character variable. The value of test is 'h'.
The size of character variable is 1 byte.


C supports three derived data types:
Data TypesDescription
ArraysArrays are sequences of data items having homogeneous values. They have adjacent memory locations to store values.
ReferencesFunction pointers allow referencing functions with a particular signature.
PointersThese are powerful C features which are used to access the memory and deal with their addresses.


C allows the feature called type definition which allows programmers to define their identifier that would represent an existing data type. There are three such types:
Data TypesDescription
StructureIt is a package of variables of different types under a single name. This is done to handle data efficiently. "struct" keyword is used to define a structure.
UnionThese allow storing various data types in the same memory location. Programmers can define a union with different members, but only a single member can contain a value at a given time. It is used for
EnumEnumeration is a special data type that consists of integral constants, and each of them is assigned with a specific name. "enum" keyword is used to define the enumerated data type.


Post a Comment