C Is Portable: This Means A Program Written For One Computer May Run Successfully On Other Computer Also
C Is Portable: This Means A Program Written For One Computer May Run Successfully On Other Computer Also
Introduction to C Language
The C Language is one of the most powerful language. In the beginning due
to the different architectures available, the programmer had to learn different
languages to create different types of applications. To overcome this problem
in 1972, Dennis Ritche at theAT & T Bell Laboratories, USA developed C
Language.
Advantages of C
C is Portable
This means a program written for one computer may
run successfully on other computer also.
C is fast
This means that the executable program obtained
after compiling and linking runs very fast.
C is compact
The statements in C Language are generally short but
very powerful.
Simple / Easy
The C Language has both the simplicity of High Level
Language and speed ofLow Level Language. So it is
also known as Middle Level Language
It is the name given to stored reason of the memory and it provides us the facility to change the
value of it during the execution. Variable names are the name given to the location in memory of
a computer where different values are stored. The location which contains these constants can be
an integer, character, real numbers.
DECLARE VARIABLE
When we want to declare any variable, then we decide that what is a data type of the variable?
And how it should declare? Variable can eight characters long only.
DATA TYPES
Data types can be represented in variety of ways in any programming language, so that we can
store data in system. C language provides us the way to hold any type of data in it. It is called
data type. In C language data types are classified into two categories:-
These can be represented on the particular machine and these are provided by every language
because without using data types we can’t save our data and can be called as storage media.
These are those data types which are consisting of combination fundamental data types
It is a data type which is used to hold data in whole number e.g. 40, 4, 97, 80 and its range is
from -32768 to 32767. When we want to use integer data type, we have to specify “int” keyword.
It takes two bytes in memory and the conversion specifier is %d.
Float type
This data type is used to store fractional numbers or these numbers are also called real numbers.
In simple language we can say, this data type contains decimal value upto six decimal places.
When we use decimal values to store then we can use it.
it can hold either positive or negative value with or without decimal the conversion specifier
used for float is %f. the range of float is -3.4*10-38 to 3.4*1038. it consumes 4 bytes in memory.
This data type is used to store character enclosed in a pair of single quotes. E.g. ‘A’, ‘B’, ‘a’or
even a blank space can be used as a character. This data type contains one byte on memory and
the conversion specifier is %c.
STRING
We can also store number of characters in char data type within the range of -128 to 127. so
when we store number of characters in char data type then it is converted into string data type.
And we use conversion specifier %s.
This data type is also used to store real type numbers and the keyword “double’ is used. It can
hold values upto 16 decimal places and it consumes 8 bytes of memory. The conversion specifier
is %lf. Its range is from 1.7*10-308 to 1.7*10308.
Long type
It contains whole number bigger than integer value is much bigger than integer. It consumes 4
bytes of memory and its range is from -2147483648 to 2147483647. Its conversion specifier is
%l. e.g. 247894, 4774863.
Boolian
This data type is used in relational operators. It gives us result in true or false. If the output is
false it returns to zero (0) and if output is true it returns to one (1). Its range is from 0 to 1 and it
has not any conversion specifier.
CONSTANTS
A constant represents that what a value is stored in it cannot be changed anytime. We use “const”
keyword for declaring any variable as constant. This keyword is a guideline to a compiler that
the value of variable is not changeable at any time during the execution of the program.