0% found this document useful (0 votes)
23 views2 pages

Second Program in C

The document discusses different data types in C including int, char, float, and double. It explains what variables are and how they are used to store data values. It provides rules for declaring variables and gives an example of declaring an integer variable.

Uploaded by

Kamlesh Garg
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views2 pages

Second Program in C

The document discusses different data types in C including int, char, float, and double. It explains what variables are and how they are used to store data values. It provides rules for declaring variables and gives an example of declaring an integer variable.

Uploaded by

Kamlesh Garg
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Second Program in C

Welcome back friends, today we will continue with Datatypes and Variables.

Datatypes: we need to first identify the type of data to store the data in C program.C language
provides four basic datatypes such as char,int,float and double.

DataType Type of Data Memory


Int Integer Type 2 bytes
Char Character Type 1 byte
Float Floating Point Numbers 4 byte
Double Floating Point Numbers with 8 byte
higher precision

Variables:A variable is a dataname used for storing a data value.It also called as memory allocators
which is used to allocate the memory for any data value in system.It can store single value at a
time.A variable can be assigned different values at different times during the program execution.

For example: marks,sum,add etc…

But there are some rules to declare variables :

1.A variable must begin with a character or an underscore(_) without any spaces.

2.The variable should not be a C keyword.

3.The variable should not be start with a digit.

4.We cannot use blank spaces and commas with in a variable name.

As we know we will have to declare the variable to store data.Before declaring variable name we will
have to mention the type of data so that variable is able to store the data of the given type. For
example: int num;

Lets take an example:

You might also like