History of C

Sheikh Ul Alam Memorial Degree College
Budgam
Mr. Ovass Shafi. (Assistant Professor)
Department of Computer Applications
C Language – An Overview (History of C)
C programming languages is the only programming language which falls under the
category of mid level programming language. Popularly known as mother of all
“languages”, C is a general purpose programming languages and can be used to develop
System as well as Application Programs.
It was originally developed by Dennis M. Ritche in 1970s at the Bell Labs in California.
The idea behind the development of C Language was to rewrite much of the Unix
Operating system in some machine independent language in order to port UNIX on to
other architecturally dissimilar machines. UNIX was originally written for a DEC PDP-7
computer by Ken Thompson, an electrical engineer and a colleague of Ritchie‟s at Bells
Labs. Thompson had written the first UNIX in a language he used to call B. To rewrite
the UNIX using assembly language was out of question, as it was not portable. There
arises a need for a language that would permit assembly like operations such as bit
manipulation along with the feature of portability. None of the languages then available
could have served the purpose. Therefore a new language was developed and hence come
into existence “C Language”.
Variable
A variable is a named memory location used to store data. The value of the variable may
change during the execution of program. To solve real world problems, we often store
some data and then retrieve it later for further processing. In order to achieve this goal
variables are used.
Data Type
In C programming language each variable has a specific data type. The data type
specifies the number of things to the compiler. It is the data type that specifies what kind
of data a variable is going to store, the number of bytes that will be allocated for a
Sheikh Ul Alam Memorial Degree College
Mr. Ovass Shafi. (Assistant Professor)
Budgam
Department of Computer Applications
variable, type of operations allowed on that variable, range of values that can assigned to
a variable and finally the format specifier for the variable used to display the value of a
variable.
Datatypes available in C
Data Types
Integer Types
Floating Point / Real Types
int
char
Range Modifiers/
Qualifiers
float
Range Modifiers /
Qualifiers
double
long
long double
unsigned
unsigned
int
signed
short
signed int short int
long
unsigned
signed
long int
unsigned
char
signed char
Sheikh Ul Alam Memorial Degree College
Budgam
Variables of Type int
Mr. Ovass Shafi. (Assistant Professor)
Department of Computer Applications
signed int / int
In C programming language, before using any variable it must be declared explicitly
along with its data type. The syntax for the declaration of variable in C programming is
as
Data type identifier;
In order to define the variable of type int, the declaration statement will look like
int num1;
int var1, var2, result;
The first statement declares an integer variable num1, the second statement declares three
integer variables namely var1, var2 and result. If we omit the range modifier/qualifier,
then the default modifier is always signed. Therefore the above statements and the given
below statements are equal
signed int num1;
signed int var1, var2, result;
We can store the signed integer values (values without fraction) in these variables, i.e.
these variables may be either positive or negative integers within the range set for the
variables of type int. The range of values that can be assigned to any variable is very
much machine dependent. For most compilers for the IBM PC ints are stored in two
consecutive bytes and are restricted to the range of -32768 to +32767. However on
modern machines ints can be of 4 bytes.
We can also define and declare the variable in the single statement like
int num1=20;
Sheikh Ul Alam Memorial Degree College
Budgam
signed int var1=10,var2=20,result=var1+var2;
Mr. Ovass Shafi. (Assistant Professor)
Department of Computer Applications
In above statements the variables are declared and defined in single statement and is
known as initialization of variable.
If we declare a variable but don‟t assign any value to it, it will not be automatically
initialized to zero (0) but will store some unknown value known as garbage value in C
terminology.
If we want to print the value of variable num1 declared above, we can do it using the
printf () function, however if we write the output statement as
printf(“Value of num1 =num1”);
The above statement will display “Value of num1 = num1”. But we want to display result
as
“Value of num1 = 20”
To display the value of the variable we have to use specific format specifier for the
variable and the format specifier for int/signed int is %d. To display value of num1 on
screen the output statement will be like
printf(“Value of num1 =%d”,num1);
Finally the operations that are allowed to be performed on the variables of type int/signed
int are addition, subtraction, multiplication, division and modulus (remainder).
The program given below will help to understand most of the concepts about signed int
type:
/*Prog2a.c*/
#include<stdio.h>
#include<conio.h>
void main()
Sheikh Ul Alam Memorial Degree College
Budgam
{
Mr. Ovass Shafi. (Assistant Professor)
Department of Computer Applications
signed int num1, num2,result;
clrscr();
num1=10;
num2=3;
result=num1+num2;
printf("\nSum of %d and %d is %d",num1,num2,result);
result=num1-num2;
printf("\nDifference of %d and %d is %d",num1,num2,result);
result=num1*num2;
printf("\nProduct of %d and %d is %d",num1,num2,result);
result=num1/num2;
printf("\nQuotient from %d Divided by %d is \ %d",num1,num2,result);
result=num1%num2;
printf("\nRemainder from %d Divided by %d is \ %d",num1,num2,result);
getch();
}
The output of above program is:
unsigned int
Usually in signed integer numbers one bit is always reserved for storing the sign of the
number. For positive numbers the sign bit is always 0 and for negative numbers the sign
bit is always 1. However if a variable is declared as unsigned int, no sign bit is used and
all the bits are used to represent the magnitude of the number. That is why unsigned int
Sheikh Ul Alam Memorial Degree College
Mr. Ovass Shafi. (Assistant Professor)
Budgam
Department of Computer Applications
can only hold positive integral values. In unsigned int we have one more bit available to
store the number and thus the range of values that can be assigned to variables of these
types is from 0 to 65535. We use unsigned integer variables when we deal with data that
is non negative. The most common use of unsigned int is to represent memory addresses.
Just as %d is used to print signed int values, %u is the format specifier for unsigned int
variables. If we want to print the value of unsigned int variable, we have to use %u
instead of %d. The following programs will help to clearly understand the use of
unsigned int data type.
Usage:
Unsigned int identifier;
short int / signed short int
The short int declaration may be useful in cases where an integer variable is known
beforehand to be small. The variable declared as short int ensures that the range of the
variable will not exceed that of signed ints. Usually short modifier is obsolete on most of
the modern computers and compilers however on some computers the range may be
shorter and may accommodate one byte of memory only and can assume values from 128 to + 127. The format specifier for signed short int is also same as that of int (%d) and
the same operations as that of int can be performed on variables of type short int.
unsigned short int
The unsigned short int declaration may be useful in cases where an integer variable is
known beforehand to be small and non negative. The variable declared as unsigned short
int ensures that the range of the variable will not exceed that of unsigned ints. Usually
unsigned short modifier is obsolete on most of the modern computers and compilers
however on some computers the range may be shorter and may accommodate one byte of
memory only and can assume values from 0 to +255. The format specifier for signed
Sheikh Ul Alam Memorial Degree College
Mr. Ovass Shafi. (Assistant Professor)
Budgam
Department of Computer Applications
short int also same as that of unsigned int (%u) and the same operations as that of
unsigned int can be performed on variables of type unsigned short int.
signed long int/long int
Syntax: signed long int population;
Or long int population;
The signed long int variables are required when we use integers larger than the range that
is available for int. On most computers long ints are 4 bytes wide and can store the values
in the range -2147483648 to +2147483647. They support the same operations that are
supported by integer variables. When we assign the value to long int variable the value on
right side is immediately followed by l Or L.
population=123421345L;
The format specifier for the long int is %ld.
unsigned long int
Syntax: unsigned long int population;
Usually in signed long integer numbers one bit is always reserved for storing the sign of
the number. For positive numbers the sign bit is always 0 and for negative numbers the
sign bit is always 1. However if a variable is declared as unsigned long int, no sign bit is
used and all the bits are used to represent the magnitude of the number. That is why
unsigned long int can only hold positive integral values. In unsigned long int we have one
more bit available to store the number and thus the range of values that can be assigned to
variables of these types is from 0 to 4294967295. We use unsigned long integer variables
when we deal with data that is non negative. Just as %ld is used to print signed long int
values, %lu is the format specifier for unsigned long int variables. If we want to print the
value of unsigned long int variable, we have to use %lu instead of %ld.
Sheikh Ul Alam Memorial Degree College
Mr. Ovass Shafi. (Assistant Professor)
Budgam
Department of Computer Applications
In the above declarations we can use short form of declarations also as shown:
Complete declaration
Short hand declaration
signed int x;
int x
unsigned int y;
unsigned y;
signed long int p;
long p;
unsigned long int q;
unsigned long q;
singed short int r;
short r;
unsigned short int s;
unsigned short s;
Variables of Type char
Sometimes the user is interested in storing character values instead of numeric values. To
store character values we can declare variable of type char. Character variable is a named
memory location that can hold a single character from the ASCII set. The character
variable occupies the least memory for storing data. A single ASCII character can be
accommodated in single byte of memory. To assign a character to character variable, the
character literal need to be enclosed in single quote. The syntax for declaring and
defining character variable is shown below:
char var1=‟a‟;
char var2;
var2=‟x‟;
Actually, character data is stored in the form of integers. Each character is assigned an
ASCII code. The ASCII code for a is 97 and that of b is 98. The ASCII code for z is 122.
For A, the ASCII code is 65 and that of B is 66. The ASCII code for Z is 90. The digits
also have ASCII codes; 48 for 0, 49 for 1, 50 for 2 and soon. The ASCII code for 9 is 57.
Sheikh Ul Alam Memorial Degree College
Mr. Ovass Shafi. (Assistant Professor)
Budgam
Department of Computer Applications
Therefore in var1 declared above, the value stored in var1 will be 0100001. Therefore
character variable are actually the subset of integers. In order to display the character
value of a variable, we can use %c as format specifier, however we can also display
ASCII/Decimal Code of any character variable using %d specifier. The range of values
that can be assigned to signed char variable is -128 to +127 and that of unsigned char
variable is 0 to +255. We can perform all the operations on character variables that can be
performed on ints. Besides we can assign integer values to character variables also. For
example if we want to assign „A‟ to character variable var1 it can be done in any of the
following ways:
char var1=‟A‟;
char var1=65;
The above two statements will do the same task.
Variables of Type float
The integer and character variables are used to store decimal and character values. We
can store only numeric data without fractional parts in the integer and character variables.
However in some applications it is necessary to work on numerals with fractional parts. C
provides the facility to the programmers to work with numerals with fractional parts
called floats. The numbers with fractional parts are called floats because the user can
change the position of the decimal point as per the precision required. The floating point
numbers has two parts namely mantissa and exponent. The mantissa part can be
fractional and may consist of integer part and fractional part. However the exponent is
always integer value and represents the position of the decimal point within the mantissa.
The floating point numbers are always signed i.e. the left most bit is always used as sign
bit. There is no unsigned floating point concept as in characters and integers. When we
assign value to floating point number, the value must be followed immediately by f; the
syntax for usage of floating point number is shown below:
Sheikh Ul Alam Memorial Degree College
Budgam
float x=123.332f;
Mr. Ovass Shafi. (Assistant Professor)
Department of Computer Applications
float y=-231.454e04f;
float z=232.02e-01f;
Variables of Type double
The float data type allows us to store values with fractional values and also to perform
calculations with fractional values but the limitation of float data type is that it provides
single precision arithmetic. But there are situations where large scale scientific or
engineering calculations are involved, and thus the double precision floating point
computations are required. The facility is available with double data type in C
programming language. The variable of type double occupies 8 consecutive bytes in
memory and provides capability to produce computational results correct to 14
significant digits. The range of values that can be assigned to variable of type double lies
between 1.7E-308 and 1.7E+308. The operations that can be performed on variable of
type double are same as that of float variables. The format specifiers used to display the
value of double variables are %lf, %le, %lg, however most common format specifier used
is %le. All the three format specifiers are counterparts of their single precision (float).
Any numeral with decimal point is treated as double even if it lies within the range of
float. So in order to treat a number with decimal point as float, it must be followed
immediately by f or F.
long double
Syntax: long double PI;
The long double variables are required when we use fractional values larger than the
range that is available for double. On most computers long doubles are 10 bytes wide and
can store the values in the range 3.4E-4932 to 3.4E+4932. They support the same
operations that are supported by float variables.
Sheikh Ul Alam Memorial Degree College
Mr. Ovass Shafi. (Assistant Professor)
Budgam
Department of Computer Applications
The format specifier for the long double is %Lf, %Le, %Lg. Most commonly used format
specifier is %Le.
Identifiers & Keywords
An identifier is any user defined word in C program used for naming variables, programs,
arrays, functions, structures, enumerations, unions etc. Names of identifiers should be
chosen as such that they represent their roles within the program for example to add two
numbers, the better variable names would be num1, num2 and sum , instead of x, y, and
z.
Rules for creating identifiers.
 The identifier names are sequences of character chosen from the set [A – Z, a – z,
0-9,_], of which the first character must not be a digit.
 No two variables must have same names as it would create name conflicts and
hence programming errors.
 Identifiers can be of any suitable length. Generally 8 – 10 characters should
suffice, though certain compilers may allow for very much longer names of upto
63 characters.
 Two identifiers will be considered different if they differ upto their first 31
characters.
 The identifier should not be same to that of some keyword.
 C is a case sensitive language, so num1, Num1 and nUm1 will be considered three
different variable names.
Some of the valid identifiers are:
Num_1, num1, _hello, hElLo, HELLO
Some of the invalid identifiers are:
1_num, while, 123, num-1, num.1, num 1
Sheikh Ul Alam Memorial Degree College
Budgam
Keywords
Mr. Ovass Shafi. (Assistant Professor)
Department of Computer Applications
Keywords are the predefined words in any programming language which can‟t be used in
any context other than that predefined in the language. A list of keywords available in C
is listed below:
auto
break
case
char
const
continue
default
do
double
else
enum
extern
float
for
goto
if
int
long
register
return
short
signed
sizeof
static
struct
switch
typedef
union
unsigned
void
volatile
while
Expressions & Operators
One of the most powerful features of C programming language is the versatility of its
operators. There are number of operators available in C for arithmetic computation,
relational operators for making comparisons, increment and decrement operators, cast
operators, assignment operators, logical operators, bitwise operators, conditional
operators and many more. We will look on some of the operators in this unit, and the rest
will be covered in subsequent chapters.
First of all we will define the term operator and operand. An Operator is a symbol that
specifies the type of operation that is to be performed like +, -, *,<, > etc. When we use
operator, we have to provide the data on which the operation is to be performed. The data
on which the specific operation is performed is known as Operand. An operand can be a
variable, constant or a literal. Some operators operate on single operand and are known as
Unary Operators for example -3, x++ etc. Some operators operate on two operands and
Sheikh Ul Alam Memorial Degree College
Mr. Ovass Shafi. (Assistant Professor)
Budgam
Department of Computer Applications
are known as Binary Operators like 2+3, 4*6, 4<6 etc. Some operators operate on three
operands and are known as Ternary Operators. There is only one tertiary operator
available in C language and is called conditional operator (?:) which we will see later in
this chapter. when we want to perform some computation, we combine the operators and
operands. The valid combination of operators and operands forms Expression which is
evaluated to get the desired results.
Basic Arithmetic Operators and Operations.
There are four basic arithmetic operators available in C. These are for addition (+),
subtraction (-), multiplication (*) and division (/). Besides we can use modulus operator
(%) to calculate the remainder by dividing dividend with a divisor. Among these
operators, addition and subtraction operator can act as unary as well as binary operators
while as rest three operators can be used as binary operators only. If we want to multiply
the two numbers and assign the result to the third variable, we will have to use three
operands (multiplier , multiplicand and destination variable) and two operators as shown:
x=y*z
In the above statement there are two operators. One is multiplication operator (*) and the
second one is assignment operator (=). The assignment operator assigns the quantity on
its right to the variable on its left. So the assignment operator‟s associativity is from right
to left in contrast to basic arithmetic operators that associates from left to right, as most of
the C operators do. Consider the statement given below:
i=i+1
One should not be confused from the above expression. In programming i=i+1 should not
be read as i is equal to i+1 (LHS = RHS). As i can‟t be equal to i+1. In programming
i=i+1 means replace the previous contents of i by adding 1 to the previous contents of i.
Each operator has two properties associated with it. The precedence and associativity.
When there is more than one operator occurring in an expression, it is the relative
Sheikh Ul Alam Memorial Degree College
Mr. Ovass Shafi. (Assistant Professor)
Budgam
Department of Computer Applications
priorities of the operators with respect to each other that will determine the order in
which the expression will be evaluated. The associativity defines the direction left-toright or right-to-left, in which the operator acts upon its operands.
The second property “priority” is also important consideration during the evaluation of
expressions.
The priority of all the C operators along with their associativity is given in table below:
Table
Precedence and Associativity of Operators
Operators (priority is increasing from top to down
Associativity.
() [] -> .
Left to Right
! ~ ++ -- + - * & (type cast) sizeof (all unary operators)
Right to Left
*/ %
Left to Right
+-
Left to Right
<< >>
Left to Right
< <= > >=
Left to Right
== !=
Left to Right
&
Left to Right
^
Left to Right
|
Left to Right
&&
Left to Right
||
Left to Right
?:
Left to Right
= += -= *= /= %= &= ^= |= <<= >>=
Right to Left
,
Left to Right
Sheikh Ul Alam Memorial Degree College
Mr. Ovass Shafi. (Assistant Professor)
Budgam
Department of Computer Applications
The operators at the top of the table parenthesis „()‟, array operator „[]‟, arrow operator „>‟ and the dot „.‟ operators are known a primary operators. All theses operators have
same priority among themselves but higher than that of all other operators. After than the
unary operators have higher priority than binary operators which in turn has higher
priority than ternary operators.
If a user is not sure about the priority of the operators, then he can make use of
parenthesis to override the normal priority of the operators for example consider the
expression
x=3*4+2
as per normal rules multiplication has higher priority than addition. So the result of above
expression will be 3*4=12 and then 12 + 2=14. Therefore x will be assigned the value of
14.
Now consider the same expression but with parenthesis.
X=3*(4+2)
The presence of parenthesis around the addition operator gives higher priority to addition
operator than multiplication. Therefore the result of above expression will be 4+2=6 and
then 3*6 =18. Therefore x will be assigned the value of 18.
Increment and Decrement operators
Most often in programming we need to update the value of the variable by some amount.
To increase the value of variable is known as increment and is done by additive operator
(+). Similarly sometimes we need to update the value of the variable by decreasing it and
is known as decrement. For example
x=x+1;
/*increment value of x by 1*/
y=y-1;
/*decrement value of y by 1*/
Sheikh Ul Alam Memorial Degree College
Mr. Ovass Shafi. (Assistant Professor)
Budgam
Department of Computer Applications
There are number of ways to increment and decrement the value of a variable and are
shown below:
x=x+1;
/*increment value of x by 1 using normal arithmetic operator*/
x=x+5;
/*increment value of x by 5 using normal arithmetic operator*/
x+=1;
/*increment value of x by 1 using arithmetic assignment operator*/
x+=3;
/*increment value of x by 3 using arithmetic assignment operator*/
x++;
/*increment value of x by 1 using post increment operator*/
++x;
/*increment value of x by 1 using pre increment operator*/
x=x-1;
/*decrement value of x by 1 using normal arithmetic operator*/
x-=1;
/*decrement value of x by 1 using arithmetic assignment operator*/
x=x-5;
/*decrement value of x by 5 using normal arithmetic operator*/
x-=5;
/*decrement value of x by 1 using arithmetic assignment operator*/
x--;
/* decrement value of x by 1 using post decrement operator*/
--x;
/* decrement value of x by 1 using pre decrement operator*/
If the post and pre increment/decrement is used on single variable without embedding in
expression then both have the same effect, i.e. increase the value of variable by 1.
However when they are used with expressions then they act differently.
The Pre increment/decrement operator updates the value of their target variables before
the execution of expressions. Once the variable is updated the expression is then
evaluated using the new values.
With Post increment/decrement operators the expression is evaluated using previous
values of variables and after the result of evaluated expression is used, the variables are
updated. The effect of increment will not be reflected in the result.
Sheikh Ul Alam Memorial Degree College
Budgam
For example if x=2, and y=3
Mr. Ovass Shafi. (Assistant Professor)
Department of Computer Applications
z=x++ + y++;
After expression evaluation, values will be x=3, y=4 and z=5. As the variables x and y
are operated on by post increment, the expression will be evaluated using the original
values of x and y i.e. 2 and 3 respectively. So z will get the value 2+3 = 5. After
evaluation of expression value of x and y will be incremented by 1. Now consider the
same expression but using pre increment using same values x=2 and y=3
z=++x + ++y;
In above expression, the value of x and y will be incremented by 1 before the evaluation
of expression and after the value of x and y becomes 3 and 4, the expression will be
evaluated and z will have the value 3+4=7.
getch(), getche(), getchar() functions (Single Character Input)
We can read character using getch (), getche () and getchar () functions also. To print
character data, we can use putchar () function. The following program illustrates the use
of printf (), scanf (), getchar (), getch (), getche () and putchar () functions.
/*Prog2l.c*/
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c;
float x,y,z;
char ch;
clrscr();
printf("\nEnter any two integer values:->");
scanf("%d%d",&a,&b);
Sheikh Ul Alam Memorial Degree College
Budgam
c=a+b;
Mr. Ovass Shafi. (Assistant Professor)
Department of Computer Applications
printf("\nSum of %d and %d is %d",a,b,c);
printf("\nEnter any two Floating Point values:->");
scanf("%f",&x);
scanf("%f",&y);
z=x+y;
printf("\nSum of %.2f and %.2f is %.2f",x,y,z);
printf("\nHit any key on keyboard:->");
fflush(stdin);
scanf("%c",&ch);
printf("\nYou Hit %c",ch);
printf("\nHit any key on keyboard:->");
ch=getch();
printf("\nYou Hit %c",ch);
printf("\nHit any key on keyboard:->");
ch=getche();
printf("\nYou Hit %c",ch);
printf("\nHit any key on keyboard:->");
fflush(stdin);
ch=getchar();
printf("You Hit ");
putchar(ch);
getch();
}
Formatted Input/Output
In C language the output is generated using printf () function. The printf () function can
be used to output character strings as well as number. So far we have used printf ()
function to simply print the output without any proper format, however the printf ()
Sheikh Ul Alam Memorial Degree College
Mr. Ovass Shafi. (Assistant Professor)
Budgam
Department of Computer Applications
function can be used to deliver the formatted output of numbers of variables and
expressions of any type.
As specified earlier, the printf () function used two arguments. The first one is control
string, and second is the list of variables. If we specify the control string and list of
variables, the output will be generated in unformatted manner. However if we want
output to be formatted, the control string is provided with Format specifications. The
Format specifications controls how the variables or expressions should be displayed on
the screen. To illustrate the unformatted output consider the following program segment.
/*Prog3g.c*/
#include<stdio.h>
#include<conio.h>
void main()
{
long int p1,p2,p3;
clrscr();
printf("\nCOUNTRY\tPOPULATION:->");
p1=123451234;
p2=12323;
p3=12312334;
printf("\nINDIA\%d",p1);
printf("\nAFGHANISTAN\%d",p2);
printf("\nAMERICA\%d",p3);
getch();
}
As seen from the output, the output is jumbled and not in proper format. It is hard to read
and understand. Now the same program can be rewritten using formatted output as
below:
Sheikh Ul Alam Memorial Degree College
Budgam
/*Prog3h.c*/
Mr. Ovass Shafi. (Assistant Professor)
Department of Computer Applications
#include<stdio.h>
#include<conio.h>
void main()
{
long int p1,p2,p3;
clrscr();
printf("\n%20s%20s","COUNTRY","POPULATION");
p1=123451234;
p2=12323;
p3=12312334;
printf("\n%20s%20d","INDIA",p1);
printf("\n%20s%20d","AFGHANISTAN",p2);
printf("\n%20s%20d","AMERICA",p3);
getch();
}
gets() and puts() functions:
For reading strings at runtime we can use either scanf() or gets() function. using scanf (),
we have to use %s as format specifier but scanf() function can read single word string.
When user inputs space character, the scanf() function terminates input process. Another
function that can be used to input strings is gets() function. This function accepts one
argument, i.e. string to be read. This function can read multiple word string and
terminates input when enter key is pressed, i.e. when newline is inserted. We can also use
puts(string) for printing the string on screen. The string input/output didn‟t require loops
for printing individual character of string as in integer, float, double , and character
arrays. The reason for this is that the format specifier starts printing elements of string
from the base address till it encounters null character. In other types of arrays there is no
Sheikh Ul Alam Memorial Degree College
Mr. Ovass Shafi. (Assistant Professor)
Budgam
Department of Computer Applications
null character and hence we need to run loop from 0 to the last element to process all the
elements of array. The following program illustrates the process of string input:
/*Prog8f.c String Input at Runtime*/
#include<stdio.h>
#include<conio.h>
void main()
{
char str1[100];
char *str2; /*dynamic string*/
clrscr();
printf("\nEnter Any Single Word String\n");
scanf("%s",str1);
printf("\nEnter Any Multiple Word String\n");
fflush(stdin);
gets(str2);
printf("\nString I is %s",str1);
printf("\nString II is %s",str2);
puts(str1);
puts(str2);
getch();
}