Breaking News
Home > Tag Archives: character

Tag Archives: character

Data type and variables in C programming

Data type and variables in C programming

In the beginning of C Programming We don’t need to know much about data type and variables. It must be known to us. Without having a sound knowledge of Data type and variable we can’t execute our program so efficiently that it should be. In this article we will see what Date type and variables in C programming is. First Start with Data type.

What is Data is and what is Data type

Data is meant literally information. But in computer science and Programming data is anything. Data could be a picture, video, text, file, folder, Gif, symbol or anything is data. Go to this link and read a knowledgeable explanation of Data. Various example of data can be categorized in Data type. In C programming Date type is categorized into two type.

  • Fundamental Data type
  • Derived Data type


In this article we will see only about Fundamental Data type. Derived data type will be discussed later. Fundamental data type has three type of Data that are

  • Integer type
  • Floating type
  • character type

Let’s know about these data types

Integer: As we know mathematically integer is a whole number. It could be positive value and negative value. Ex. 5, 10, 0, 12, -89, -100

Floating: Floating is also a number but having a decimal value. it could be positive value or negative value. Ex. 5.25, 10.2, 0.005, -0.2, -25.125 etc. Thus, 5.0 is not equal to 5 in C program understanding even mathematical value is equal. So, Float is not equal to integer.

Character: Character is used to define alphabets. Ex. ‘a’, ‘b’ etc.

Let’s see what variable is and what could be its size.

Variable could be understood as a blank memory where you can hold data type (integer, floating or character) and time to time you can change the value of data type in this memory. Let’s assume you write a program where you want to know the age of your client. Okay, so the client will input his age. Thus you need to allocate a blank memory space where his input (age) can be stored. In this way you use variable to hold data type.

Integer size is 2 byte or 4 byte. Each byte has 8 bits. It means the size of integer either 16 bits or 32 bits. It means it will hold date within the range. In the 32 bits of Integer can hold 2^32 (-2147483648 to -2147483647). In 16 bits of Integer can hold 2^16 (-32768 to 32767).

“Float” size is 4 byte but “double” size is 8 byte.

Character size is 1 byte. It means every character (b, c, z) you write takes one byte each. Blank Space also takes 1 byte.

How to use variable

Using of variable is very easy. Just write date type and then name of variable. Look at below for example of Integer, float, double and character

int age; 
float si;
double ad;
character a;

int is used to define integer and then give any name of variable you wish. age is the name of  variable where any integer value will be stored. si is the name of variable where any float value will be stored, ad is the name variable where any double value will be stored. a is the name of variable where any character will be stored.

you can also define the value of data type.

int age=25; 
float si=2.25;
double ad=25635.256;
character a='n';

When defining character value you need ‘quote’.

Note : The following “keyword” is not used as a variable because these have special meaning in C programming

Auto Double If Static
Break Int else Struct
Case enum long switch
char extern near typedef
const float register union
continue far return unsigned
Default for short void
Do goto signed while

Watch this video for practical information

Power by

Download Free AZ | Free Wordpress Themes