tag:blogger.com,1999:blog-24196773198964942172024-03-27T16:53:15.870-07:00Basics of ProgrammingUnknownnoreply@blogger.comBlogger12125tag:blogger.com,1999:blog-2419677319896494217.post-37432831905005376962013-03-08T01:19:00.001-08:002013-03-08T01:19:32.536-08:00const modifier in c:<br />
<h3>
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">const modifier in c:<o:p></o:p></span></h3>
<div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: justify;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt;">In c
all variables are by default not constant. Hence, you can modify the value of
variable by program. You can convert any variable as a constant variable by
using modifier const which is keyword of c language.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: justify;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt;">Properties
of constant variable:<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: justify;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: justify;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt;">1. You
can assign the value to the constant variables only at the time of declaration.
For example:<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: justify;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: justify;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt;">const</span><span style="font-family: 'Times New Roman', serif; font-size: 12pt;"> int i=10;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: justify;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt;">float</span><span style="font-family: 'Times New Roman', serif; font-size: 12pt;"> const f=0.0f;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: justify;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt;">unsigned</span><span style="font-family: 'Times New Roman', serif; font-size: 12pt;"> const long double ld=3.14L;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: justify;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: justify;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt;">2.
Uninitialized constant variable is not cause of any compilation error. But you
cannot assign any value after the declaration. For example:<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: justify;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: justify;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt;">const</span><span style="font-family: 'Times New Roman', serif; font-size: 12pt;"> int i;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: justify;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: justify;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt;">If you
have declared the uninitialized variable globally then default initial value
will be zero in case of integral data type and null in case of non-integral
data type. If you have declared the uninitialized const variable locally then
default initial value will be garbage.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: justify;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: justify;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt;">3.
Constant variables executes faster than non constant variables.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: justify;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: justify;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt;">4. You
can modify constant variable with the help of pointers. For example:<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: justify;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: justify;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt;">#include</span><span style="font-family: 'Times New Roman', serif; font-size: 12pt;"><stdio.h><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: justify;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt;">int</span><span style="font-family: 'Times New Roman', serif; font-size: 12pt;"> main(){<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: justify;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt;"> const int i=10;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: justify;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt;"> int *ptr=&i;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: justify;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt;">
*ptr=(int *)20;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: justify;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt;">
printf("%d",i);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: justify;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt;"> return</span><span style="font-family: 'Times New Roman', serif; font-size: 12pt;"> 0;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: justify;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt;">}<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: justify;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: justify;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt;">Output:
20 <o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
Unknownnoreply@blogger.com54tag:blogger.com,1999:blog-2419677319896494217.post-82057716714950375022013-03-08T01:17:00.000-08:002013-03-08T01:17:11.475-08:00Constants<br />
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<v:roundrect arcsize="10923f" fillcolor="white [3201]" id="_x0000_s1026" strokecolor="black [3200]" strokeweight="5pt" style="height: 28.5pt; left: 0; margin-left: 0; margin-top: 62.75pt; mso-position-horizontal-relative: margin; mso-position-horizontal: center; position: absolute; text-align: left; width: 130.5pt; z-index: 251704320;"><br /></v:roundrect><b><u><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">Constants:</span></u></b><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"> A constant is a value that does not change
during the program execution. As its name implies it is a constant or fixed
value. Constants are declared with the ‘const’ keyword. Constants in every
language remain same. In some languages, constants are also known as literals.
The constants can be classified as integer constant, floating constant,
character constant and string constant. For example: const data_type var;</span><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"> </span></div>
<br clear="ALL" />
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<b><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">Integer Constant:</span></b><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"> An integer is a whole number without decimal point. An integer may be
either 0-9 digits or the combination of 0-9. Integer can be further divided
into three different number systems: decimal (base 10), octal (base 8) and
hexadecimal (base 16).<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<b><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">Octal:</span></b><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"> 1) It consists of numeric range 0-7 or combination of 0-7 numbers.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">2) The first digit must be 0 in order to identify the constant as an
octal.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">3) For example: 00, 010, and 0200.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<b><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">Decimal:</span></b><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"> 1) It consists of any combination of 0-9 digits. It is the most
commonly used number system.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">2) It is normal counting number of mathematics. The first digit needs
not to be zero.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">3) For example: 0, 8, 156, 25378 etc.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<b><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">Hexadecimal:</span></b><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"> It consists of 0-9 digits and alphabets ‘a’ to ‘f’ or ‘A’ to ‘F’. Here
‘a’ to ‘f’ represents the decimal values 10 to 15. ‘A’ or ‘a’ is 10, ‘B’ or ‘b’
is 11 and so on.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">2) A hexadecimal number must begin with 0x or OX.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">3) For example: 0x0, 0x10, 0x265 etc.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<b><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">Rules for integer constants:</span></b><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"> 1) it may be either positive or negative.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">2) It must not have any decimal point.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">3) No commas or blank spaces are allowed in an integer.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">4) It must have at least one digit.<o:p></o:p></span></div>
<b><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"><br clear="all" style="mso-special-character: line-break; page-break-before: always;" />
</span></b>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<b><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">Floating Constant:</span></b><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"> A floating point constant has a real value. It is a numeric value with
decimal point. It may be either of single precision or of double precision
type. It may be written in two forms called the fraction form and exponent
form.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">Fraction form: In the fraction form, the value is represented as a whole
number followed by a decimal point. For example: 130.35, -0.67<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">Rules for fraction form: 1) a decimal point should be present.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">2) No commas or spaces are allowed.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">3) It may be +ve or -ve but default is +ve.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">Exponential form: In the exponential form a floating point constant has
a mantissa part and exponent. The mantissa part and exponent part should be
separated by e or E. For example: a number 234.56 can be written as 2.3456e2 or
2.3456e+2 i.e. 2.3456*10^2 Here 2.3456 represents mantissa part and the part
after 'e' is exponent part, which has a base 10.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">Rules: 1) the mantissa part can be written in positive or negative.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">2) Spaces and commas are not allowed.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">3) Letter e can be written in uppercase or lowercase.<o:p></o:p></span></div>
<b><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"><br clear="all" style="mso-special-character: line-break; page-break-before: always;" />
</span></b>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<b><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">Character constant:</span></b><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"> A character constant is a single alphabet, single digit
or single symbol which is enclosed in single quotes (' '). Every character
constant has a unique ASCII value. For example ASCII value of 'A' is 65. The
maximum length of a character constant is only one character. For example: 'a',
'&', '2' etc.<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt;">A character can be any ASCII character, printable or not printable
from values -128 to 127. (But only 0 to 127 are used.) Control characters i.e.
non printable characters are put into programs by using a
backslash \ and a special character or number. The characters and
their meanings are:<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt;">\b<o:p></o:p></span></div>
<div class="MsoNormal" style="margin: 0in 0in 0.0001pt 0.5in;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt;">backspace
BS <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt;">\f<o:p></o:p></span></div>
<div class="MsoNormal" style="margin: 0in 0in 0.0001pt 0.5in;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt;">form
feed FF (also clear screen) <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt;">\n<o:p></o:p></span></div>
<div class="MsoNormal" style="margin: 0in 0in 0.0001pt 0.5in;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt;">new
line NL (like pressing return) <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt;">\r<o:p></o:p></span></div>
<div class="MsoNormal" style="margin: 0in 0in 0.0001pt 0.5in;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt;">carriage
return CR (cursor to start of line) <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt;">\t<o:p></o:p></span></div>
<div class="MsoNormal" style="margin: 0in 0in 0.0001pt 0.5in;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt;">horizontal
tab HT <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt;">\v<o:p></o:p></span></div>
<div class="MsoNormal" style="margin: 0in 0in 0.0001pt 0.5in;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt;">vertical
tab (not all versions) <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt;">\"<o:p></o:p></span></div>
<div class="MsoNormal" style="margin: 0in 0in 0.0001pt 0.5in;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt;">double
quotes (not all versions) <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt;">\'<o:p></o:p></span></div>
<div class="MsoNormal" style="margin: 0in 0in 0.0001pt 0.5in;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt;">single
quote character ' <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt;">\\<o:p></o:p></span></div>
<div class="MsoNormal" style="margin: 0in 0in 0.0001pt 0.5in;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt;">backslash
character \ <o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<br /></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">These are some certain character constants that start with backslash
(\). Such characters are known as escape sequence character. There are
predefined in compile and used with output statements. These characters are non
printable and have some specific tasks. <o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<b><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">String constant:</span></b><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"> A string constant is a group of characters, which is enclosed in double
quotes. So it is also called double quotes character constant. The characters
enclosed in double quotes may be alphabet, digits, special symbols, escape
sequence and spaces. For example: "This is my pen", "hi...\ this
is Vijraj Bhargav", "My mobile number is 9872871471".<o:p></o:p></span></div>
Unknownnoreply@blogger.com9tag:blogger.com,1999:blog-2419677319896494217.post-32764496959085692242013-03-08T01:13:00.001-08:002013-03-08T01:13:59.397-08:00Variables<br />
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<b><u><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">Variables:</span></u></b><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"> A variable is a symbolic name of a location in the computer's memory.
In this variable, a value can be stored and this can be used in the program.
The value of a variable may change during the program execution. Only one value
can be stored at a time in it. In a variable you can store integer value or
float value, character value or string names according to the requirement. As
we know that a variable is an identifier of certain data. Every variable must
have a name and a data type. A data type is the type of data which is to be
stored in a variable. It can be an integer, floating, character or string name
values. These values can be assigned to the variable using assignment operator:
= (equal to)<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">Example of variable: sum=5+10; Here sum is a variable and 5 & 10 are
two integer constant values. + And = are two operators. Semicolon (;) is used
in the end of every C statement. This tells that it is end of statement.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<b><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"><br /></span></b></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<b><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">Rules for naming variables: </span></b><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">1) a variable must be unique in a program’s
block.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">2) A variable name can contain only alphabets, digits and underscore. No
any other symbol can be used.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">3) The variable name must begin with a letter or an underscore.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">4) A variable name must not start with a digit.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">5) C language is a case sensitive language. It means upper case and
lower case letters are different variable.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">6) A variable name must not contain any white space. The white space
includes tab, spacebar and new line.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">7) It can’t be a C language keyword or reserve word. As we know that C
is a case sensitive language and we can use different case of keywords as variable
name.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">8) A variable name cannot use a symbol in naming.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">9) Some valid examples are: a, box, tab10, roll_no, Roll_no, _abc, For.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">10) Some invalid examples are: 10tab, for, ab$c, roll no.<b><o:p></o:p></b></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">11) The length of variable name should be of 31 characters. If it is
more than 31 characters then compiler will not generate any error but it will
recognize only first 31 characters.<o:p></o:p></span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"><br /></span>
<br />
<h2>
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">Where to declare Variables: </span><span style="font-family: 'Times New Roman', serif; font-size: 12pt; font-weight: normal; line-height: 115%;">There are two kinds of
place in which declarations can be made. </span><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"><o:p></o:p></span></h2>
<ol start="1" type="1">
<li class="MsoNormal"><span style="font-family: "Times New Roman","serif"; font-size: 12.0pt;">One
place is outside all of the functions. That is, in the space between
function definitions. (After the<span class="apple-converted-space"> </span><code><span style="font-family: "Times New Roman","serif"; mso-ansi-font-size: 12.0pt; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-theme-font: minor-fareast;">#include</span></code><span class="apple-converted-space"> </span>lines, for example.) Variables
declared here are called global variables. They are also called static and
external variables in special cases.)<o:p></o:p></span></li>
</ol>
<div class="MsoNormal" style="margin: 0in 0in 0.0001pt 0.25in;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt;">#include
<stdio.h><o:p></o:p></span></div>
<div class="MsoNormal" style="margin: 0in 0in 0.0001pt 0.25in;">
<br /></div>
<div class="MsoNormal" style="margin: 0in 0in 0.0001pt 0.25in;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt;">int
globalinteger; /* Here!
outside {} */<o:p></o:p></span></div>
<div class="MsoNormal" style="margin: 0in 0in 0.0001pt 0.25in;">
<br /></div>
<div class="MsoNormal" style="margin: 0in 0in 0.0001pt 0.25in;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt;">float
global_floating_point;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin: 0in 0in 0.0001pt 0.25in;">
<br /></div>
<div class="MsoNormal" style="margin: 0in 0in 0.0001pt 0.25in;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt;">main
()<o:p></o:p></span></div>
<div class="MsoNormal" style="margin: 0in 0in 0.0001pt 0.25in;">
<br /></div>
<div class="MsoNormal" style="margin: 0in 0in 0.0001pt 0.25in;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt;">{<o:p></o:p></span></div>
<div class="MsoNormal" style="margin: 0in 0in 0.0001pt 0.25in;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt;">}<o:p></o:p></span></div>
<div class="MsoListParagraph" style="mso-add-space: auto; mso-list: l0 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in; text-align: justify; text-indent: -.25in; text-justify: inter-ideograph;">
<!--[if !supportLists]--><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">2.<span style="font-family: 'Times New Roman'; font-size: 7pt; line-height: normal;">
</span></span><!--[endif]--><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">The
other place where declarations can be made is following the opening brace, {},
of a block. Variables of this kind only work inside their braces {} and are
often called local variables. Another name for them is automatic variables.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin: 0in 0in 0.0001pt 0.25in; text-align: justify;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt;">main
()<o:p></o:p></span></div>
<div class="MsoNormal" style="margin: 0in 0in 0.0001pt 0.25in; text-align: justify;">
<br /></div>
<div class="MsoNormal" style="margin: 0in 0in 0.0001pt 0.25in; text-align: justify;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt;"> { int a;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin: 0in 0in 0.0001pt 0.25in; text-align: justify;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt;"> float x,y,z;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin: 0in 0in 0.0001pt 0.25in; text-align: justify;">
<br /></div>
<div class="MsoNormal" style="margin: 0in 0in 0.0001pt 0.25in; text-align: justify;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt;"> /* statements */<o:p></o:p></span></div>
<div class="MsoNormal" style="margin: 0in 0in 0.0001pt 0.25in; text-align: justify;">
<br /></div>
<div class="MsoNormal" style="margin: 0in 0in 0.0001pt 0.25in; text-align: justify;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt;"> }<o:p></o:p></span></div>
</div>
Unknownnoreply@blogger.com5tag:blogger.com,1999:blog-2419677319896494217.post-86847604197490983072013-03-08T01:12:00.002-08:002013-03-08T01:12:28.245-08:00Identifiers<br />
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<b><u><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">Identifiers:</span></u></b><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"> A name or identifier in C can be anything from a single letter to a
word. Identifiers are the names given to program elements such as variables,
function names, array names and structure names. Once a type or value is
assigned to an identifier, it cannot be changed during the execution of the
program. For example: if an integer variable named as 'x' then 'x' will always
remain an integer variable which can hold only integer or numeric value.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<b><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"><br /></span></b></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<b><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">Rules of identifier:</span></b><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"> 1) an identifier must be unique in a program.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">2) An identifier can contain only alphabets, digits and underscore. No
any other symbol can be used.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">3) The identifier must begin with a letter or an underscore.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">4) An identifier must not start with a digit.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">5) C language is a case sensitive language. It means upper case and
lower case letters are different identifier.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">6) An identifier must not contain any white space. The white space
includes tab, spacebar and new line.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">7) It can’t be a C language keyword or reserve word. As we know that C
is a case sensitive language and we can use different case of keywords as
identifier.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">8) An identifier cannot use a symbol in naming.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">9) Some valid examples are: a, box, tab10, roll_no, Roll_no, _abc, For.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">10) Some invalid examples are: 10tab, for, ab$c, roll no.<o:p></o:p></span></div>
Unknownnoreply@blogger.com2tag:blogger.com,1999:blog-2419677319896494217.post-16491520511505195222013-03-06T00:34:00.001-08:002013-03-06T00:34:59.939-08:00Keywords<br />
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<b><u><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">Keywords:</span></u></b><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"> Some words in C programming are reserved for some special tasks. Such
words are known as keywords. Their meaning is predefined in the compiler and
compiler knows what to do with these keywords. Keywords are also known as the
reserved words because these are reserved for C compiler. The programmer cannot
use these words as variable or identifier in program. As we know that C is a
case sensitive language and we can use different case of the keywords as
identifier. The color of the keywords in C language is white. C language has
total 40 keywords. 32 keywords are used in routine programming but remaining 8
characters are used in low level programming and rarely used. These 32 keywords
are:<o:p></o:p></span></div>
<div style="margin-bottom: 12.0pt;">
<span style="font-family: 'Helvetica, sans-serif', serif;">auto
else long switch
<br />
break enum register typedef <br />
case extern return union <br />
char float <i>short </i>unsigned <br />
const for signed void <br />
continue goto sizeof volatile <br />
default if static while <br />
do int</span><span style="font-family: 'Helvetica Narrow', serif; font-size: 18pt;"> </span><span style="font-family: 'Helvetica, sans-serif', serif;">struct double </span><o:p></o:p></div>
Unknownnoreply@blogger.com4tag:blogger.com,1999:blog-2419677319896494217.post-38367869239118633422013-03-06T00:31:00.001-08:002013-03-06T00:31:04.480-08:00Character set and C-Tokens<br />
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<b><u><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">Character Set:</span></u></b><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"> C is a powerful programming language. Not only C, every language
follows some rules. These rules are required for writing a program. In order to
write a program some alphabets, digits and special symbols are used. All this
is known as Character set. Character set is used to write program blocks,
variables and identifiers etc. Character set consists of the upper and lower
case alphabets, digits, special characters and white space.<b><u><o:p></o:p></u></b></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<b><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">Alphabets:</span></b><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"> It consists of both upper and lower case alphabets. It can be ‘A’ to
‘Z’ or ‘a’ to ‘z’ or combination of the alphabets. These are used for naming
purpose. C language is a case sensitive language. It means that lower and upper
case alphabets are different. For example: 'A' is different from 'a'. Both can
be used in the program and both can contain different values. But one thing
should be noted that same variable or name cannot be used for two purposes. If
we do so then it will create a big confusion.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<b><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">Digits:</span></b><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"> Digits represent to the numeric values. These are used by the
programmer for assigning the values to the variables. Digits are same as the
mathematical digits i.e. 0 to 9 or combination of the digits. It consists both
of positive and negative numbers. Also it includes decimal point values. The
programmer can assign any numeric value depending on the data type. For
example: a=5, b=109, c=-69, d=48.56<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<b><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">Special Symbols:</span></b><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"> On the keyboard all keys are special symbols except alphabets, digits
and function keys or hot keys. Such as: &, $, @. All these symbols are used
for special purposes.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<b><u><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">Tokens:</span></u></b><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"> Tokens are various C program elements. Tokens are identified by the
compiler during compilation. Tokens are useful for compiler to detect errors.
When tokens are not arranged in a particular sequence then compiler generates
an error message. These tokens are: <b>Keywords, Identifiers, Variables,
Constants and Delimiters or separators</b><o:p></o:p></span></div>
Unknownnoreply@blogger.com12tag:blogger.com,1999:blog-2419677319896494217.post-79711464368377854962013-03-06T00:29:00.001-08:002013-03-06T00:29:32.056-08:00Types of Errors<br />
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<b><u><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">Types of error:</span></u></b><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"> An error is considered as a speed breaker in the process
of program developing. This error may be of any type. There are four types of
errors.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">1) Syntax error, 2) Linking error, 3) Run Time error, 4) Logical error<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<b><u><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">Syntax error:</span></u></b><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"> This error occurs when the rule or syntax of the language is broken.
Such errors may be of missing semi colon, missing of any punctuation, misuse of
any term etc. For example: c = (a+b/2; Here in example, closing bracket is
missing after b. <o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-indent: 1.0in; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">All syntax errors must be found and corrected
before a program is made to run. Almost all the language compilers and
interpreters are designed to detect syntax errors. The language processors
print error messages on the screen that indicates the number of the statement
with errors and gives hints of nature of the error.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<b><u><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">Linking error:</span></u></b><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"> As we know that each language comes with built in libraries and basic
functions. To execute a program we use these basic functions along with the
libraries. It is the responsibility of the linker to link the function with the
library. If the linker does not find the library then an error is generated.
This error is known as linking error. For example: if main() method's library
is not defined i.e. stdio.h <o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<b><u><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">Runtime error:</span></u></b><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"> It is not sure that after successfully compiling and linking a program,
it will display the desired result. The result may be wrong due to errors in
logic such as division by zero, square root of a negative number. Runtime
errors are harder to find and to correct them. It is because compiler does not
tell us about the error. Compiler does not tell the number of line in which the
occurred and also not the nature of the error.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<b><u><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">Logic
Errors:</span></u></b><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"> </span><i><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">Logic
errors</span></i><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"> are those that appear once the application is in use.
They are most often unwanted or unexpected results in response to user actions.
In this case the language processor successfully translates the source code
into machine code. Also a computer actually does not know that an error has
occurred. It follows the instructions and produces the results, but this output
may be wrong. For example, a mistyped key or other outside influence might
cause your application to stop working. Logic errors are generally the hardest
type to fix, since it is not always clear where they originate.</span><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"><o:p></o:p></span></div>
Unknownnoreply@blogger.com62tag:blogger.com,1999:blog-2419677319896494217.post-86818047681171312152013-03-06T00:24:00.001-08:002013-03-06T00:24:09.089-08:00Assembler, Compiler, Interpreter, Linker, Loader<br />
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<b><u><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">Assembler:</span></u></b><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"> A computer will not understand any program written in a language, other
than its machine language. The programs written in other languages must be
translated into the machine language. Such translation is performed with the
help of software. A program which translates an assembly language program into
a machine language program is called an assembler. If an assembler which runs
on a computer and produces the machine codes for the same computer then it is
called self assembler or resident assembler. If an assembler that runs on a
computer and produces the machine codes for other computer then it is called
Cross Assembler.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-indent: 1.0in; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">Assemblers are further divided into two
types: One Pass Assembler and Two Pass Assembler. One pass assembler is the
assembler which assigns the memory addresses to the variables and translates
the source code into machine code in the first pass simultaneously. A Two Pass
Assembler is the assembler which reads the source code twice. In the first
pass, it reads all the variables and assigns them memory addresses. In the
second pass, it reads the source code and translates the code into object code.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<b><u><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">Compiler:</span></u></b><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"> It is a program which translates a high level language program into a
machine language program. A compiler is more intelligent than an assembler. It
checks all kinds of limits, ranges, errors etc. But its program run time is
more and occupies a larger part of the memory. It has slow speed. Because a
compiler goes through the entire program and then translates the entire program
into machine codes. If a compiler runs on a computer and produces the machine
codes for the same computer then it is known as a self compiler or resident
compiler. On the other hand, if a compiler runs on a computer and produces the
machine codes for other computer then it is known as a cross compiler.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<b><u><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">Interpreter:</span></u></b><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"> An interpreter is a program which translates statements of a program
into machine code. It translates only one statement of the program at a time.
It reads only one statement of program, translates it and executes it. Then it
reads the next statement of the program again translates it and executes it. In
this way it proceeds further till all the statements are translated and
executed. On the other hand, a compiler goes through the entire program and
then translates the entire program into machine codes. A compiler is 5 to 25
times faster than an interpreter.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-indent: 1.0in; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">By the compiler, the machine codes are saved
permanently for future reference. On the other hand, the machine codes produced
by interpreter are not saved. An interpreter is a small program as compared to
compiler. It occupies less memory space, so it can be used in a smaller system
which has limited memory space.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<b><u><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">Linker:</span></u></b><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"> In high level languages, some built in header files or libraries are
stored. These libraries are predefined and these contain basic functions which
are essential for executing the program. These functions are linked to the
libraries by a program called Linker. If linker does not find a library of a
function then it informs to compiler and then compiler generates an error. The
compiler automatically invokes the linker as the last step in compiling a
program.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-indent: 1.0in; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">Not built in libraries, it also links the
user defined functions to the user defined libraries. Usually a longer program
is divided into smaller subprograms called modules. And these modules must be
combined to execute the program. The process of combining the modules is done
by the linker.<o:p></o:p></span></div>
<b><u><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"><br clear="all" style="mso-special-character: line-break; page-break-before: always;" />
</span></u></b>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<b><u><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">Loader:</span></u></b><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"> Loader is a program that loads machine codes of a program into the
system memory.<span style="background: white;"> In<span class="apple-converted-space"> Computing</span>, a<span class="apple-converted-space"> </span><b>loader</b><span class="apple-converted-space"> </span>is the part of an<span class="apple-converted-space"> Operating System </span>that is
responsible for loading programs. It is one of the essential stages in the
process of starting a program. Because it places programs into memory and
prepares them for execution. Loading a program involves reading the contents of<span class="apple-converted-space"> </span>executable file into memory. <span class="apple-converted-space"> </span>Once loading is complete, the
operating system starts the program by passing control to the loaded program
code. All operating systems that support program loading have loaders. In many
operating systems the loader is permanently resident in memory. </span><o:p></o:p></span></div>
Unknownnoreply@blogger.com241tag:blogger.com,1999:blog-2419677319896494217.post-23700296775457362142013-03-06T00:22:00.001-08:002013-03-06T00:22:38.380-08:00Programming language<br />
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<b><u><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">Programming Language:</span></u></b><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"> An artificial language used to write
programs that can be translated into machine language and then executed by a
computer. As we know that computer understands only machine language. It does
not understand the English language or any other what we normally use. So to
perform tasks from computer we use programming language to write programs.
These programs tell the computer what to do? Each natural language has a method
of using symbols of that language. In English, the method is given by the rules
of the grammar. These rules tell us which word to use when and how to use it.
Similarly, the rules of a programming language must also be used. These rules
are known as “<b>Syntax Rules</b>”. In case of natural language people can use
poor and incorrect language, but in case of programming language we can’t use.
Each language has strict syntax rules and these rules cannot be ignored. Each program
has its own syntax and this is further converted to machine language. Now after
the conversion, machine is able to understand the task. This conversion is done
by compiler or interpreted. A compiler or interpreter is tool that converts the
program into machine language. Each programming has its own compiler or
interpreter. Programming language can be classified into three broad categories:
<b>1) Machine Language 2) Assembly Language and 3) High Level Language.</b><o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<b><u><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">Machine Language:</span></u></b><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"> It is the language of the computer machine itself. A
machine can understand this language directly without any translator. It is
also known as Binary language. It is only two digits language i.e. 0s and 1s.
It is first generation of the programming languages. Machine language was used
when the computer was of a huge size; approximately it covered one room. <o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"> Only the
developers could work with the computer. Because it was not easy as it is
today. Input was firstly converted into the Binary language of zeros and ones. Then
fed to computer, computer processed it and output is generated. This output is
also in the form of machine language. Again it was converted to human
understandable language English. Thus it was a headache giver task.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"> Machine
language is the fundamental language of the machines. Each machine we see today
works on the machine language. We give input in English and machine works on
the machine code. Some interfaces are
there that converts our language into machine language. The circuitry of a
machine is wired in such a way that it immediately recognizes the machine
language and operates the machine. <o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"> Machine
language is not very easy language to learn. It is difficult to read and
understand. The most important advantage of machine language is that programs
written in machine language are executed very fast by the computer. This is
mainly because machine language is directly understood by the CPU and no
translation of the program is required. However writing a program in machine
language has several disadvantages; Machine Dependent, Difficult to program and
Difficult to modify. Machine dependent means the machine code of one machine
will not work for other machine.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"> Machine
Language is the toughest language of all the generations. Only developers of
this language and experienced scientists can use this language. New learner or
normal users can’t even understand it because of its complexity.<o:p></o:p></span></div>
<b><u><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"><br clear="all" style="mso-special-character: line-break; page-break-before: always;" />
</span></u></b>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<b><u><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">Assembly Language:</span></u></b><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"> In machine language we write the programs in binary code
i.e. 0s and 1s. That is headache giver task. But this headache is reduced by
the Assembly Language. In Assembly Language, programs can be easily written in
alphanumeric symbols instead of 0s and 1s. For good and effective programming,
meaningful and easily remember able symbols are selected. For example: ADD for
addition, SUB for subtraction, CMP for comparison etc. Such symbols are known
as <b>Mnemonics</b>. A language which uses these mnemonics symbols is known as
Assembly Language. A program written in assembly language is known as assembly
language program.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-indent: 1.0in; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">The advantage of assembly language is that
the execution time of an assembly language program is less. An assembly
language program runs faster to produce results.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-indent: 1.0in; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">The most disadvantage of assembly language is
that programming in this language is difficult and time consuming. Assembly
language is machine dependent. The programmer must have detailed knowledge of
the structure of the computer. He must have the knowledge of registry of the
computer. The program written in assembly language for one computer cannot be
used in any other computer. It means that the assembly language program is not
portable. Each processor has its own instruction sets and hence its own
assemble language.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<b><u><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">High Level Language:</span></u></b><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"> A language, in which instructions are
written, is called High Level Language. The instructions written in a high
level language are called statements. These statements are closer to English
and mathematics as compared to mnemonics in assembly languages. Example of high
level languages are BASIC, PASCAL, FORTRAN, COBOL, ADA, C, C++, C# and JAVA
etc.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-indent: 1.0in; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">High level languages are independent of
computer architecture. A programmer does not need knowledge of architecture of
the computer. The programming is easier. The same program can run on any other
computer which has a compiler of that language. The compiler is machine
dependent but not the language. Thus language is machine independent.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-indent: 1.0in; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">High level languages are very similar to English
like language. These are easy to learn and use. The programmer needs not to
learn anything about the computer. He need not to worry about how to store the
code in the computer, where to store them, what to do with them etc. All this
was in the previous languages.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-indent: 1.0in; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">Writing programs in high level languages
requires less time and effort. Programs written in high level languages are
easier to maintain than assembly language or machine language programs. This is
because these are easier to understand, easier to correct and modify. Insertion
or removal of instructions from a program is also possible.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-indent: 1.0in; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">Disadvantage of high level language is that
it takes more time to run and requires more computers’ main memory.<o:p></o:p></span></div>
<b><u><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"><br clear="all" style="mso-special-character: line-break; page-break-before: always;" />
</span></u></b>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<b><u><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">Source and Object Language:</span></u></b><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"> The language in which a programmer writes
programs is called source language. It may be high level language or an
assembly language. The language in which the computer works is called object
language or machine language. A program written in a source language is called
a source program. When source program is converted into machine code by an
assembler or compiler it is known as an object program. In other words, a
machine code program ready for execution is called an object program.<o:p></o:p></span></div>
Unknownnoreply@blogger.com298tag:blogger.com,1999:blog-2419677319896494217.post-50301755971684971782013-03-06T00:17:00.002-08:002013-03-06T00:17:11.178-08:00Algorithm <div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<b><u><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">Algorithm:</span></u></b><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"> </span><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">It
is a sequence of instructions (or set of instructions) to make a program more
readable. It is a process used to answer a question. </span><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">In simple words an algorithm is a step-by-step
procedure for solving a problem. Algorithms can be expressed in any language,
from natural languages like English to programming languages like C. We use
algorithms every day. For example, a recipe for baking a cake is an algorithm.
Most programs consist of algorithms. Making algorithm is one of the principal
challenges in programming language. <em>An algorithm must always terminate
after a finite number of steps. Simple example of algorithm to add two numbers:</em><em><span style="font-style: normal;"><o:p></o:p></span></em></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<em><span style="font-size: 12pt; line-height: 115%;"> An algorithm must have
one starting point and one or more ending point. Its starting point can be
labeled as START and its ending point can be labeled as STOP. Here is example
of one starting point and one ending point.</span></em><em><span style="font-size: 12pt; font-style: normal; line-height: 115%;"><o:p></o:p></span></em></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<em><b><span style="font-size: 12pt; line-height: 115%;">Example of adding two
numbers:</span></b></em><em><b><span style="font-size: 12pt; font-style: normal; line-height: 115%;"><o:p></o:p></span></b></em></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<em><b><span style="font-size: 12pt; line-height: 115%;">Step 1:</span></b></em><em><span style="font-size: 12pt; line-height: 115%;">
Start.</span></em><em><span style="font-size: 12pt; font-style: normal; line-height: 115%;"><o:p></o:p></span></em></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<em><b><span style="font-size: 12pt; line-height: 115%;">Step 2:</span></b></em><em><span style="font-size: 12pt; line-height: 115%;">
Take three variables named num1, num2, num3.</span></em><em><span style="font-size: 12pt; font-style: normal; line-height: 115%;"><o:p></o:p></span></em></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<em><b><span style="font-size: 12pt; line-height: 115%;">Step 3:</span></b></em><em><span style="font-size: 12pt; line-height: 115%;">
Input the values in two variables: num1 = 10, num2 = 5.</span></em><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"><o:p></o:p></span></div>
<div class="MsoNormal">
<em><b><span style="font-size: 12pt; line-height: 115%;">Step
4:</span></b></em><em><span style="font-size: 12pt; line-height: 115%;"> Now add num1 & num2 and put its value to
num3: num3 = num1 + num2. Here both operands num1 and num2 are added and its
combined value is assigned to num3.</span></em><em><span style="font-size: 12pt; font-style: normal; line-height: 115%;"><o:p></o:p></span></em></div>
<div class="MsoNormal">
<em><b><span style="font-size: 12pt; line-height: 115%;">Step
5:</span></b></em><em><span style="font-size: 12pt; line-height: 115%;"> Now print the value of num3. Your result is
displayed on the screen.</span></em><em><span style="font-size: 12pt; font-style: normal; line-height: 115%;"><o:p></o:p></span></em></div>
<div class="MsoNormal">
<em><b><span style="font-size: 12pt; line-height: 115%;">Step
6:</span></b></em><em><span style="font-size: 12pt; line-height: 115%;"> Stop.</span></em><em><span style="font-size: 12pt; font-style: normal; line-height: 115%;"><o:p></o:p></span></em></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<b><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">Example of finding bigger number between two numbers with
one START and two STOP:<o:p></o:p></span></b></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<em><b><span style="font-size: 12pt; line-height: 115%;">Step 1: </span></b></em><em><span style="font-size: 12pt; line-height: 115%;">START.</span></em><em><span style="font-size: 12pt; font-style: normal; line-height: 115%;"><o:p></o:p></span></em></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<em><b><span style="font-size: 12pt; line-height: 115%;">Step 2: </span></b></em><em><span style="font-size: 12pt; line-height: 115%;">Take
two variables named num1, num2.</span></em><em><span style="font-size: 12pt; font-style: normal; line-height: 115%;"><o:p></o:p></span></em></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<em><b><span style="font-size: 12pt; line-height: 115%;">Step 3: </span></b></em><em><span style="font-size: 12pt; line-height: 115%;">Read
num1 and num2.</span></em><em><span style="font-size: 12pt; font-style: normal; line-height: 115%;"><o:p></o:p></span></em></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<em><b><span style="font-size: 12pt; line-height: 115%;">Step 4: </span></b></em><em><span style="font-size: 12pt; line-height: 115%;">if
num1>num2 then</span></em><em><span style="font-size: 12pt; font-style: normal; line-height: 115%;"><o:p></o:p></span></em></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<em><b><span style="font-size: 12pt; line-height: 115%;">Step 5: </span></b></em><em><span style="font-size: 12pt; line-height: 115%;">print
num1.</span></em><em><span style="font-size: 12pt; font-style: normal; line-height: 115%;"><o:p></o:p></span></em></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<em><b><span style="font-size: 12pt; line-height: 115%;">Step 6: </span></b></em><em><span style="font-size: 12pt; line-height: 115%;">STOP.</span></em><em><span style="font-size: 12pt; font-style: normal; line-height: 115%;"><o:p></o:p></span></em></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<em><b><span style="font-size: 12pt; line-height: 115%;">Step 7: </span></b></em><em><span style="font-size: 12pt; line-height: 115%;">else</span></em><em><span style="font-size: 12pt; font-style: normal; line-height: 115%;"><o:p></o:p></span></em></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<em><b><span style="font-size: 12pt; line-height: 115%;">Step 8: </span></b></em><em><span style="font-size: 12pt; line-height: 115%;">print
num2.</span></em><em><span style="font-size: 12pt; font-style: normal; line-height: 115%;"><o:p></o:p></span></em></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<em><b><span style="font-size: 12pt; line-height: 115%;">Step 9: </span></b></em><em><span style="font-size: 12pt; line-height: 115%;">STOP.</span></em><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"><o:p></o:p></span></div>
<br />Unknownnoreply@blogger.com12tag:blogger.com,1999:blog-2419677319896494217.post-55446748787647272182013-03-06T00:16:00.000-08:002013-03-06T00:16:10.623-08:00Features of C language<br />
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<b><u><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">Features:</span></u></b><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"> C language is known as a middle level language, because it contains the
features of both low level language and high level language. Its features are
as below:<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">1. <b>Clarity:</b> C language is quite close to English language. So its
syntax is clearer and more understandable. Its variables, names etc are written
in simple English. <o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">2. <b>Portability:</b> C language is a portable and can be run on any
machine. It is independent of the type of CPU and machine.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">3. <b>Built in:</b> Various built in functions are available in C to perform
required operations.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">4. <b>Modular:</b> C language is a modular programming language which
makes a “Divide and Conquer” approach. In this approach we can module the
programs and they are now easy to manage and understand.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">5. <b>Quicker Compiler: </b>The speed of executing the C programs is
very fast. A program in C, created on
one computer can be compiled and run on any other machine that has a similar C
compiler.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">6. <b>Simplicity:</b> C language is easy to learn and easy to debug
(Debug means to make a program error free). Because of its easiness it is
widely used from micro computers to mainframe computers.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">7. <b>Detect ability:</b> It is a User Friendly language. C compiler
detects the errors easily and displays along with the program. It means C
compiler tells us that where the errors are. It tells us the type and number of
the line in which the error is present.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">8. <b>Location of Data:</b> It supports to the Pointer concept which
tells us that where variables are stored in the computer memory.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">9. C language is <b>case sensitive</b> language. It means lower case and
upper case letters are considered as different.<o:p></o:p></span></div>
Unknownnoreply@blogger.com11tag:blogger.com,1999:blog-2419677319896494217.post-25660334807712346692013-03-05T01:45:00.000-08:002013-03-05T01:45:39.874-08:00Intro of C<br />
<div align="center" class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: center;">
<b><u><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">Basic
of C language<o:p></o:p></span></u></b></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<b><u><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">Introduction:</span></u></b><b><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"> </span></b><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">C
language was designed by Dennis Ritchie at Bell Laboratories between 1969 and
1972. There were many developments of C language between 1969 and 1972. And
final language came into existence in 1972. Like other languages C language was
undergone a number of versions. In every new version many new features were
added to make it more powerful and more useful. It was not written as a
teaching help, but as an implementation language. It was developed for
developing operating systems, utility programs and compilers. C is a powerful
structured and module programming. Like most high level languages, C is a
modular programming language. In which each task can be developed as a module. It
was written when computers were big and they capital equipments.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"> C language
is mainly influenced by the language B, which was further influenced by the
BCPL language. C language was also influenced by the languages such as CPL,
Assembly, FORTRAN and ALGOL. This C language further influenced some languages
such as C++, C--, C sharp, Java, JavaScript and Perl etc.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"> C language
is known as middle level language because it consist the features of low level language
and high level language. Low level features are used for low level programming
and High level features are used for high level programming and mostly the high
level programming is developed.<o:p></o:p></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify; text-justify: inter-ideograph;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"> The first
major use of C language was to write an operating system called UNIX. The
success of UNIX operating system and its features brought the consequent
popularity for the C language. It was standardized in 1989 by ANSI (American
National Standards Institute) known as ANSI C.<o:p></o:p></span></div>
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"><br clear="all" style="mso-special-character: line-break; page-break-before: always;" />
</span>
<br />
<div class="MsoNormal">
<br /></div>
Unknownnoreply@blogger.com9