About Me

Hey friends! My name is yuvraj basnet. I'm going to introduce myself.I have born and grown up in india(chandigarh) and I'm studying second year of B.C.A computer science field. My father serving in indian air force. My mother has been taking care of house hold. I am a friendly person, good thinker, I can work for longer hours without any break, only if I'm interested in that...My life style is very simple.


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