<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-3217380662150918380</id><updated>2024-08-30T01:12:55.646-07:00</updated><title type='text'>Computer TECHnology ROCKZ</title><subtitle type='html'>This is a blog about things related to programming languages, their syntax and everything about computers and its applications and the things to be known to fasten your computer etc.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://ctechrockz.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3217380662150918380/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://ctechrockz.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/15825313850821005204</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>11</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3217380662150918380.post-4546310103833070740</id><published>2013-07-02T13:15:00.001-07:00</published><updated>2013-07-02T13:46:25.283-07:00</updated><title type='text'>Structures</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;Introduction:&lt;/span&gt;&lt;/h2&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;Structure is a function which stores the block of memory. However, &lt;b&gt;arrays &lt;/b&gt;also stores the memory, but they have limitation that they contains same type of data(i.e, only integer type functions or character type etc...).&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;Some times we require a data structure that can store data items of mixed data type. Certain items are made up of different variables and different members of different data types(i.e, all kinds of data types-integers, characters, float etc...).&lt;/span&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=3217380662150918380&quot; imageanchor=&quot;1&quot; style=&quot;clear: right; float: right; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;/a&gt;&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;b&gt;For example,&lt;/b&gt;&amp;nbsp;a bank accountant contains his name, Id, and his date of joining etc... These three were of different kinds of data types. Name is defined by character data type, Id is defined by long int data type, and date of joining is defined by integer data type.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;table border=&quot;1&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;MsoTableGrid&quot; style=&quot;border-collapse: collapse; border: none; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 0in 5.4pt 0in 5.4pt;&quot;&gt;
 &lt;tbody&gt;
&lt;tr style=&quot;height: 36.85pt; mso-yfti-firstrow: yes; mso-yfti-irow: 0;&quot;&gt;
  &lt;td style=&quot;border: solid windowtext 1.0pt; height: 36.85pt; mso-border-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 117.9pt;&quot; valign=&quot;top&quot; width=&quot;157&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&lt;/span&gt;Member &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-left: none; border: solid windowtext 1.0pt; height: 36.85pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 120.4pt;&quot; valign=&quot;top&quot; width=&quot;161&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&lt;/span&gt;Data type&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr style=&quot;height: 85.0pt; mso-yfti-irow: 1; mso-yfti-lastrow: yes;&quot;&gt;
  &lt;td style=&quot;border-top: none; border: solid windowtext 1.0pt; height: 85.0pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 117.9pt;&quot; valign=&quot;top&quot; width=&quot;157&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;Name&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;ID&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;DOJ&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 85.0pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 120.4pt;&quot; valign=&quot;top&quot; width=&quot;161&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=3217380662150918380&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;Char&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;Long int&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;int&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=3217380662150918380&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;/a&gt;&lt;/div&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=3217380662150918380&quot; imageanchor=&quot;1&quot; style=&quot;clear: right; float: right; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;/a&gt;&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;The collective information about an accountant is known as a &quot;structure&quot;. precisely, a structure can be defined as &quot;&lt;/span&gt;&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;b&gt;a group of data types of different members&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;.&quot;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=3217380662150918380&quot; imageanchor=&quot;1&quot; style=&quot;clear: right; float: right; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;/a&gt;&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;Here, Name, id, and date of joining are the members of a structure. Each member is a variable that can be referred to through the name of the structure. Variable form a group under a single name for ease of using and handling of same.&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;table border=&quot;1&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;MsoTableGrid&quot; style=&quot;border-collapse: collapse; border: none; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-yfti-tbllook: 1184;&quot;&gt;
 &lt;tbody&gt;
&lt;tr style=&quot;height: 17.95pt; mso-yfti-firstrow: yes; mso-yfti-irow: 0;&quot;&gt;
  &lt;td style=&quot;border: solid windowtext 1.0pt; height: 17.95pt; mso-border-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 74.05pt;&quot; valign=&quot;top&quot; width=&quot;99&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;b&gt;&lt;i&gt;Variable&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-left: none; border: solid windowtext 1.0pt; height: 17.95pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 105.15pt;&quot; valign=&quot;top&quot; width=&quot;140&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;b&gt;&lt;i&gt;Member&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-left: none; border: solid windowtext 1.0pt; height: 17.95pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 109.7pt;&quot; valign=&quot;top&quot; width=&quot;146&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;b&gt;&lt;i&gt;Data type&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr style=&quot;height: 19.0pt; mso-yfti-irow: 1;&quot;&gt;
  &lt;td style=&quot;border-top: none; border: solid windowtext 1.0pt; height: 19.0pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 74.05pt;&quot; valign=&quot;top&quot; width=&quot;99&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;b1&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 19.0pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 105.15pt;&quot; valign=&quot;top&quot; width=&quot;140&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;name, id, DOJ&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 19.0pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 109.7pt;&quot; valign=&quot;top&quot; width=&quot;146&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;char, long int, int&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr style=&quot;height: 19.0pt; mso-yfti-irow: 2; mso-yfti-lastrow: yes;&quot;&gt;
  &lt;td style=&quot;border-top: none; border: solid windowtext 1.0pt; height: 19.0pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 74.05pt;&quot; valign=&quot;top&quot; width=&quot;99&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;b2&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 19.0pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 105.15pt;&quot; valign=&quot;top&quot; width=&quot;140&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;name, id, DOJ&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 19.0pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 109.7pt;&quot; valign=&quot;top&quot; width=&quot;146&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;char, long int, int&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;b&gt;For example, &lt;/b&gt;consider a bank accountant structure. Let us assume that the structure defined by a name &quot;Bank&quot;[Don&#39;t get confused by the name of the structure and by the name of bank accountant. They both differ each other. Since structure contains all the details of the bank accountant, so bank accountant name is one kind of member of the structure and that structure has a name, defined by the user]. Suppose if there are three banks, then we need to declare three names to identify separately, since all the three banks contains names of the accountant,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;id etc...Assume Bank1 is declared as b1; Bank2 as b2; Bank3 as b3. Therefore b1, b2, b3 are known as variables of the stucture &quot;Bank&quot;. The number of variables and members depends on the user&#39;s declaration.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;Defining a structure with its keyword:&lt;/span&gt;&lt;/h2&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;A structure is defined by a keyword &lt;b&gt;struct&lt;/b&gt;. Strcut is followed by the name of the structure and the body of the structure which is enclosed with in curly braces. Whole body contains the declaration of its members. And each member must and should contain the user defined data type(i.e; int, char, float,....). Defining a structure ends by a semicolon.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;b&gt;Structure is declared by the below given syntax:&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;struct &amp;lt;name&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&amp;nbsp; &amp;nbsp; data type member1;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&amp;nbsp; &amp;nbsp; data type member2;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&amp;nbsp; &amp;nbsp; data type member3;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&amp;nbsp; &amp;nbsp; .&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&amp;nbsp; &amp;nbsp; .&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&amp;nbsp; &amp;nbsp; .&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;};&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;b&gt;For example consider the following structure&#39;s definition:&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;struct Bank&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&amp;nbsp; char e_name[10];&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&amp;nbsp; long int Id;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&amp;nbsp; int DOJ;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;};&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;Here, &lt;b&gt;struct &lt;/b&gt;is a keyword(obviously it is compulsory for each and every structure to define). &lt;b&gt;Bank &lt;/b&gt;is an identifier or else it can be known as&amp;nbsp;structure&#39;s tag name, and also known as user-defined type, since it is given by the user(programmer). The body of the structure contains three members, they are of:&lt;/span&gt;&lt;/div&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;b&gt;&amp;nbsp;e_name &lt;/b&gt;to store the name of the employer since name contains characters, it is declared by &#39;char&#39; data type.&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;b&gt;Id &lt;/b&gt;to store the id of an employer, since it has all the integer values with long number of digits, so it is declared by &#39;long int&#39; data type.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;b&gt;DOJ &lt;/b&gt;to store the date of joining, since it has only integer values, so it is declared by &#39;int&#39; data type.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;Definition doesn&#39;t reserve any memory space, but the members we declared in different data types will store some memory according to the bytes. It define in what way and how much information we can store according to the user.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;u style=&quot;font-weight: bold;&quot;&gt;A point to be noted&lt;/u&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;: &lt;/span&gt;The same member names can occur in different&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;structures.&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;Declaring a&amp;nbsp;structure variable:&lt;/span&gt;&lt;/h2&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;If a&amp;nbsp;structure is declared, then we can declare variables and members to store the information. variables are specially known to store the information of particular&amp;nbsp;structure type. Simply we can &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;say that a file does a work to store all the details provide by the user. In the same way the variable does to store the information(i.e; members). When a&amp;nbsp;structure definition is placed in-front of the program code(i.e; global area), it will be visible to all the functions in the program. In the case, we can declare variables of type&amp;nbsp;structure in global area or with in any function as local variables.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;b&gt;Declaring a variable of type Bank:&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;struct Bank b1;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;This statement can be used in any function.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;Once a variable is declared, memory equivalent to total of&amp;nbsp;memory required by individual members of&amp;nbsp;structure&lt;b&gt;&amp;nbsp;&lt;/b&gt;Bank is allocated to b1.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;u style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif; font-weight: bold;&quot;&gt;Two points to be noted&lt;/u&gt;&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif; font-weight: bold;&quot;&gt;:&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;b&gt;1. &lt;/b&gt;If we want&amp;nbsp;structure variables to be local to a function, we have to define&amp;nbsp;structure with in that function. In that case,&amp;nbsp;structure becomes local to that function and would not be accessible to other functions.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;b&gt;2.&lt;/b&gt;&amp;nbsp;If we give this definition at global place, then the&amp;nbsp;structure variables become global and would be accessible to all functions which is again not recommended.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;b&gt;We can declare a variable in two methods:&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;b&gt;1. &amp;nbsp;&lt;/b&gt;struct Bank&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;char e_name[20];&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;long int Id;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;int DOJ;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;}b1,b2,b3;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;b&gt;2.&lt;/b&gt;&amp;nbsp; struct Bank&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;{&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/b&gt;char e_name[20];&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; long int Id;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int DOJ;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;};&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;void main()&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;struct Bank b1;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;struct Bank b2;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;struct Bank b3;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;u style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif; font-weight: bold;&quot;&gt;A point to be noted&lt;/u&gt;&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif; font-weight: bold;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;Tag name is compulsory in the 2nd method. Variable should be declared with its keyword struct and its &amp;lt;tag name&amp;gt;.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;Here, struct is constant, and tag name is optional to the user.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;b&gt;Diagrammatic representation of allocating memory to the structure variable b1:&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgnsnu6iOTzpuJenZBy1Ie6sDavSE3f763x7ZDHox1_AewDuVgkhpvgjTDNxAobmVRXwEuGFQTwSPlyVNgonGdllhKduZa77qKbBwSQDpfEf_055SPxrL5_lZQ-dru3fMN-tEvniYXdStAX/s640/Photo-0007.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;240&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgnsnu6iOTzpuJenZBy1Ie6sDavSE3f763x7ZDHox1_AewDuVgkhpvgjTDNxAobmVRXwEuGFQTwSPlyVNgonGdllhKduZa77qKbBwSQDpfEf_055SPxrL5_lZQ-dru3fMN-tEvniYXdStAX/s320/Photo-0007.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;u style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif; font-weight: bold;&quot;&gt;A point to be noted&lt;/u&gt;&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif; font-weight: bold;&quot;&gt;:&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;Structure variables will allocate members in continuous memory locations.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;Therefore b1 reserves the sum of the memory bytes declared by the individual members(i.e, 20+4+2=26 bytes).&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;b&gt;Declaring values to structure members:&lt;/b&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;Between&amp;nbsp;structure variable name and member name a dot operator is used to access a structure.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;b&gt;The syntax is given below:&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;structure_variable_name.member_name&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;b&gt;For example consider the below given statements:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;Suppose if we want input all the details of an employer who is from Bank1. &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; Therefore declaring values will be like: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; gets(b1.e_name); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; scanf(&quot;%d&quot;,&amp;amp;b1.Id); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; scanf(&quot;%d&quot;,&amp;amp;b1.DOJ);&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;If we want to print the values then the statements would be like: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; puts(b1.e_name); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; printf(&quot;%d&quot;,b1.Id); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; printf(&quot;%d&quot;,b1.DOJ);&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;b&gt;A sample program code based on the functions which we have been discussed till now:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;simple C program structure to input and output the data&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;#include&amp;lt;conio.h&amp;gt;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;#include&amp;lt;stdio.h&amp;gt;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;struct Bank&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;{&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;&amp;nbsp; char e_name[20];&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;&amp;nbsp; long int Id;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;&amp;nbsp; int DOJ;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;};&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;void main()&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;{&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;struct Bank b1;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;printf(&quot;enter the details of an employer&quot;);&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;printf(&quot;\n enter the name of the employer:&quot;);&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;gets(b1.e_name);&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;printf(&quot;enter the Id:);&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;scanf(&quot;%ld&quot;,&amp;amp;b1.Id);&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;printf(&quot;enter date of joining:&quot;);&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;scanf(&quot;%d&quot;,&amp;amp;b1.DOJ);&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;printf(&quot;\n employer&#39;s details&quot;);&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;printf(&quot;\n Name of an employer is&quot;);&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;puts(b1.e_name);&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;printf(&quot;\n Id of an employer is %ld&quot;,b1.Id);&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;printf(&quot;\n Date of joining of an employer is %d&quot;,b1.DOJ);&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;getch();&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;}&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;b&gt;Output:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;enter the details of an employer&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;enter the name of an employer: Raj&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;enter the Id: 12100&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;enter date of joining: 2&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;employer&#39;s details&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;Name of an employer is Raj&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;Id of an employer is 12100&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;Date of joining of an employer is 2&lt;/span&gt;&lt;br /&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;Initializing a structure:&lt;/span&gt;&lt;/h2&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;Like any other data type we can initialize&amp;nbsp;structures when we declare variables of&amp;nbsp;structure. We can provide initialization values separated by comma with in pair of curly braces. The order of values must match with the order of members declared in the&amp;nbsp;structure definition.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;u style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif; font-weight: bold;&quot;&gt;A point to be noted&lt;/u&gt;&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif; font-weight: bold;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;Data type of the member must be declared in the&amp;nbsp;structure only. And the&amp;nbsp;structure declaration is compulsory.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;b&gt;For example,&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;struct Bank b1={&quot;Raj&quot;,12100, 2};&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;The initialization of each and every member is as following:&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;e_name field of name is initialized to &quot;Raj&quot;,&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;Id is initialized to 12100,&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;DOJ is initialized to 2.&lt;/span&gt;&lt;/div&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;Nested Structure:&lt;/span&gt;&lt;/h2&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;The&amp;nbsp;structure inside a&amp;nbsp;structure is known as &quot;nested&amp;nbsp;structure&quot;. Simply we can say that nested&amp;nbsp;structure is known when structure acts as a member of another structure. This system can be used to create complex data type structures.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;b&gt;For example, &lt;/b&gt;we are required to store information about student such as the name, roll_no. , marks, and date of birth. All of these members act as individual elements except date of birth which is made up of three members, via. day, month, and year. So we can define structure date that itself act as a member of structure student as below.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;struct DOB&amp;nbsp;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;{&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;&amp;nbsp; int d;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;&amp;nbsp; int m;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;&amp;nbsp; int y;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;};&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;struct student&amp;nbsp;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;{&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;&amp;nbsp; char name[10];&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;&amp;nbsp; int rank;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;&amp;nbsp; int marks;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;&amp;nbsp; struct DOB dob;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;};&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;Here is an another way to access the structure DOB inside the structure student. It exists with in the scope of the structure student.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;struct student&amp;nbsp;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;{&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;&amp;nbsp; char name[10];&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;&amp;nbsp; int rank;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;&amp;nbsp; int marks;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;&amp;nbsp; struct DOB&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;&amp;nbsp; {&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;&amp;nbsp; &amp;nbsp; int d;&amp;nbsp;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;&amp;nbsp; &amp;nbsp; int m;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;&amp;nbsp; &amp;nbsp; int y;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;&amp;nbsp; }dob;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;}s1;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;The members of nested structures are accessed from outermost variable to innermost variable with the help of dot (.) operators.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;Also here is another way to define the variable of structure student. Directly we can define as given above, orelse we can use a statement such as struct student s1;&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;struct student&amp;nbsp;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;{&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;&amp;nbsp; char name[10];&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;&amp;nbsp; int rank;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;&amp;nbsp; int marks;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;&amp;nbsp; struct DOB&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;&amp;nbsp; {&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;&amp;nbsp; &amp;nbsp; int d;&amp;nbsp;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;&amp;nbsp; &amp;nbsp; int m;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;&amp;nbsp; &amp;nbsp; int y;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;&amp;nbsp; }dob;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;};&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;void main()&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;struct student s1;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;Therefore the following statements are illustrated to initialize &amp;nbsp;the member of structure DOB:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;s1.dob.d=24;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;s1.dob.m=12;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;s1.dob.y=1994;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;And if you are willing to initialize only for student members, then the statement would be like:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;s1.name=&quot;Raj&quot;;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;We can use more levels of nested structure and access the members of nested&amp;nbsp;structure in the same way from outermost&amp;nbsp;variable to innermost variable names with the help of dot operator.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;Initialization of Nested Structure&lt;/span&gt;&lt;/h2&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=3217380662150918380&quot; imageanchor=&quot;1&quot; style=&quot;clear: right; float: right; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;/a&gt;&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;If a member of &amp;nbsp;structure is itself a&amp;nbsp;structure, then initialization values of that&amp;nbsp;structure is enclosed with in curly braces.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;The following code initializes variable s1 of type student:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;struct student s1={&quot;Raj&quot;, 32, 680, {24, 12, 1994}};&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;Array of structures:&lt;/span&gt;&lt;/h2&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;In real life, we need to work on number of files like storing the data of accountants, students, employee etc... In that case, we need to create number of variables of type employer, student etc... Here is an easy way to access these variables as an array.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;b&gt;For example&lt;/b&gt;, we can create 20 elements array of type employer as below:&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;struct employer e[20];&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;Here, 20 contiguous memoryy blocks are reserved to store information for 20 employee. Each block is divided into a set of members declared in the&amp;nbsp;structure. We can work on 20 employee referring to their variable &lt;b&gt;e&lt;/b&gt;&amp;nbsp;followed by an index, by a dot operator, and ending with&amp;nbsp;structure member like:&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;puts(e[i].name);&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;printf(&quot;%ld&quot;, e[i].Id);&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;scanf(&quot;%d&quot; , &amp;amp;e[i].DOJ);&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;We can also initialize the array&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;structure directly.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;i&gt;struct Bank b[5]={{&quot;Raj&quot;, 12100, 2},&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;i&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&quot;Ravi&quot;, 12101, 3},&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;i&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&quot;Rahul&quot;, 12102, 4},&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;i&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;};&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;From site : http://ctechrockz.blogspot.com/&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://ctechrockz.blogspot.com/feeds/4546310103833070740/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ctechrockz.blogspot.com/2013/07/structures.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3217380662150918380/posts/default/4546310103833070740'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3217380662150918380/posts/default/4546310103833070740'/><link rel='alternate' type='text/html' href='http://ctechrockz.blogspot.com/2013/07/structures.html' title='Structures'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/15825313850821005204</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgnsnu6iOTzpuJenZBy1Ie6sDavSE3f763x7ZDHox1_AewDuVgkhpvgjTDNxAobmVRXwEuGFQTwSPlyVNgonGdllhKduZa77qKbBwSQDpfEf_055SPxrL5_lZQ-dru3fMN-tEvniYXdStAX/s72-c/Photo-0007.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3217380662150918380.post-2306549465777783419</id><published>2013-06-24T10:18:00.000-07:00</published><updated>2013-06-24T10:35:27.973-07:00</updated><title type='text'>Simple C Programs Based On File Handling.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;span lang=&quot;EN-IN&quot;&gt;**Program
which replaces a particular character in the file with another character. In
case the character&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;repeats
then only the last occurrence is replaced.**&lt;/span&gt;&lt;/h2&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;#include&amp;lt;stdio.h&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;#include&amp;lt;conio.h&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;int
main()&lt;b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FILE *fp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;span lang=&quot;EN-IN&quot;&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; int pos; &amp;nbsp;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&amp;nbsp;//Opening the file in the write mode.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
fp=fopen(&quot;srecord.txt&quot;,&quot;w&quot;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(fp==NULL)&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf(&quot;\nError&quot;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&lt;/b&gt;&amp;nbsp; char str[]=&quot;Sample String in a
File&quot;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;span lang=&quot;EN-IN&quot;&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; char c,c1,c2;&amp;nbsp;&lt;/i&gt;&lt;/span&gt;&amp;nbsp;//Writing to the file using fputs&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
fputs(str,fp);&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fflush(fp);&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf(&quot;\nEnter character you want to
search&quot;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; scanf(&quot;%c&quot;,&amp;amp;c1);&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf(&quot;\nEnter character you want to
modify&quot;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fflush(stdin);&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;span lang=&quot;EN-IN&quot;&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; scanf(&quot;%c&quot;,&amp;amp;c2); &amp;nbsp;&amp;nbsp;&lt;/i&gt;&lt;/span&gt;//Taking the file pointer to the beginning
of the file&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;span lang=&quot;EN-IN&quot;&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; rewind(fp); &amp;nbsp;&amp;nbsp;&lt;/i&gt;&lt;/span&gt;//Reading the file character by character
till the EOF.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/b&gt;
while((fscanf(fp,&quot;%c&quot;,&amp;amp;c))!=EOF)&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/i&gt; //Store the position with the match&lt;i&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(c==c1)&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pos=ftell(fp)-1;&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/i&gt;//Take the file pointer to the beginning.&lt;i&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;span lang=&quot;EN-IN&quot;&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; rewind(fp); &amp;nbsp;&amp;nbsp;&lt;/i&gt;&lt;/span&gt;//Position the file pointer at the
replacement point&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;span lang=&quot;EN-IN&quot;&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fseek(fp,pos,0); &amp;nbsp;&amp;nbsp;&lt;/i&gt;&lt;/span&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp;&lt;/i&gt;//Printing other character at its place&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;span lang=&quot;EN-IN&quot;&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fprintf(fp,&quot;%c&quot;,c2); &amp;nbsp;&amp;nbsp;&lt;/i&gt;&lt;/span&gt;//Taking the pointer to the beginning&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; rewind(fp);&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;span lang=&quot;EN-IN&quot;&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf(&quot;\nContents of the file are
&quot;); &amp;nbsp; &lt;/i&gt;&lt;/span&gt;//Printing the contents on the screen&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; while((fscanf(fp,&quot;%s&quot;,str))!=EOF)&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf(&quot;%s &quot;,str); &amp;nbsp; &amp;nbsp;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;span lang=&quot;EN-IN&quot;&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fclose(fp); &amp;nbsp;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;i&gt;&amp;nbsp;&lt;/i&gt;//Closing the file.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; getch();&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;} &amp;nbsp; &amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;Program
2: Reading and writing data in to the file using structure.&lt;/span&gt;&lt;/h2&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;#include&amp;lt;stdio.h&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;#include&amp;lt;conio.h&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;span lang=&quot;EN-IN&quot;&gt;&lt;i&gt;#include&amp;lt;stdlib.h&amp;gt; &amp;nbsp;&lt;/i&gt;&lt;/span&gt;//Creating
structure&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;struct
student&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;char
name[20];&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;int
rollno;&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;float
marks;&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;};&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;void
Write();&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;void
Read(); &amp;nbsp;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;span lang=&quot;EN-IN&quot;&gt;&lt;i&gt;FILE
*fp; &amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;span lang=&quot;EN-IN&quot;&gt;&lt;i&gt;&amp;nbsp;&lt;/i&gt;&lt;/span&gt;//File stream pointer&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;int
count;&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;//Structure
Variable which will be read and written&lt;i&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;struct
student s1;&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;int
main()&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;int
ch;&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;while(1)&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;printf(&quot;\n1.Write
Data&quot;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;printf(&quot;\n2.Read
Data&quot;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;printf(&quot;\n3.Exit&quot;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;printf(&quot;\nChoice&quot;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;scanf(&quot;%d&quot;,&amp;amp;ch);&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;if(ch==1)&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;Write();&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;if(ch==2)&lt;b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;Read();&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;if(ch==3)&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;exit(0);&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;void
Write()&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;count++;&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;//Open
the file in a+ mode so as to read and write data to the file&lt;i&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;fp=fopen(&quot;K1201.txt&quot;,&quot;a+&quot;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;printf(&quot;\nName:-
&quot;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;fflush(stdin);&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;gets(s1.name);&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;printf(&quot;\nRoll
Number:- &quot;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;scanf(&quot;%d&quot;,&amp;amp;s1.rollno);&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;printf(&quot;\nMarks:-
&quot;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;scanf(&quot;%f&quot;,&amp;amp;s1.marks);&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;//Use
the fwrite function to write the data to the file&lt;b style=&quot;font-style: italic;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;fwrite(&amp;amp;s1,sizeof(struct
student),1,fp);&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;//Close
the file after writing the data&lt;i&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;fclose(fp);&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;void
Read()&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;int
i;&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;//Open
the file in a+ mode so that we can read and write the data&lt;i&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;fp=fopen(&quot;K1201.txt&quot;,&quot;a+&quot;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;for(i=0;i&amp;lt;count;i++)&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;{&lt;b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;//Read
all the records from the file one by one. We are reading an entire&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;//structure
variable one at a time&lt;i&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;fread(&amp;amp;s1,sizeof(struct
student),1,fp);&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;printf(&quot;\nName:-
%s&quot;,s1.name);&lt;b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;printf(&quot;\nRoll
Number:- %d&quot;,s1.rollno);&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;printf(&quot;\nMarks:-
%f&quot;,s1.marks);&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;}&lt;b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;b&gt;//&lt;/b&gt;Closing
the file&lt;b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;fclose(fp);&lt;b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;}&lt;b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/i&gt;
&lt;i&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/i&gt;
&lt;i&gt;&lt;br /&gt;&lt;/i&gt;
&lt;i&gt;&lt;br /&gt;&lt;/i&gt;
From site : http://ctechrockz.blogspot.com/&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://ctechrockz.blogspot.com/feeds/2306549465777783419/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ctechrockz.blogspot.com/2013/06/simple-c-programs-based-on-file-handling.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3217380662150918380/posts/default/2306549465777783419'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3217380662150918380/posts/default/2306549465777783419'/><link rel='alternate' type='text/html' href='http://ctechrockz.blogspot.com/2013/06/simple-c-programs-based-on-file-handling.html' title='Simple C Programs Based On File Handling.'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/15825313850821005204</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3217380662150918380.post-3353544882649310957</id><published>2013-06-02T10:23:00.003-07:00</published><updated>2013-06-24T10:35:03.935-07:00</updated><title type='text'>On Software Systems.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;
&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;A Brief Discussion About Software Systems:&lt;/span&gt;&lt;/h2&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;System software consists of programs that which manages the hardware resources&lt;/span&gt; of a computer. And it performs the required tasks. These programs are further classified to three categories: &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;System support, System development, and the Operating system.&lt;/span&gt;&lt;/div&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;
Operating Systems:&lt;/span&gt;&lt;/h2&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;The Operating systems provides services such as user interface, files, and data base access. And also interface to&amp;nbsp; communication systems such as Internet Protocols. The primary purpose of this operating system&#39;s software is to keep the system operating in an efficient manner.&lt;/span&gt;&lt;/div&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;
System Support:&lt;/span&gt;&lt;/h2&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;The System software provides system utilities and other operating services. Examples are of sort programs and disk format programs. Operating services consists of programs that provide performance statistics for the operational staff and security monitors to protect the system and the data.&lt;/span&gt;&lt;/div&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;
System Development Software:&lt;/span&gt;&lt;/h2&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;The System development software includes the language translation that convert programs into machine language for execution, debugging tools to ensure that the programs are error free and &lt;b&gt;Computer Assisted Software Engineering(CASE)&lt;/b&gt;systems.&lt;/span&gt;&lt;br /&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;/h2&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;From site : http://ctechrockz.blogspot.com/&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://ctechrockz.blogspot.com/feeds/3353544882649310957/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ctechrockz.blogspot.com/2013/06/on-software-systems.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3217380662150918380/posts/default/3353544882649310957'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3217380662150918380/posts/default/3353544882649310957'/><link rel='alternate' type='text/html' href='http://ctechrockz.blogspot.com/2013/06/on-software-systems.html' title='On Software Systems.'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/15825313850821005204</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3217380662150918380.post-7162288939938286621</id><published>2013-06-02T10:17:00.001-07:00</published><updated>2013-06-24T10:34:39.068-07:00</updated><title type='text'>On Software Applications.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;
Software Applications:&lt;/span&gt;&lt;/h2&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;Same as like System Software&#39;s, Application Software is also classified into two categories:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;General Purpose Software, and the Application Specific Software.&lt;/span&gt;&lt;/div&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;
General Purpose Software:&lt;/span&gt;&lt;/h2&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;It is purchased from Software developers and it can be used for more than one application. Word processors, Data Base Management Systems, and Computer Aided Designing or Drafting Systems comes under these software systems.&lt;/span&gt;&lt;/div&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;
Application Specific Software:&lt;/span&gt;&lt;/h2&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;It can be used only for its intended or achieving purposes. A general ledger(i.e. a book in which a company or organization write downs the amount of money it spends and receives) system used by accounts and a material requirement planning systems used by a manufacturing organization are examples of Application Specific Software. They can be used only for the task for which they are designed.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;From site : http://ctechrockz.blogspot.com/&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://ctechrockz.blogspot.com/feeds/7162288939938286621/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ctechrockz.blogspot.com/2013/06/on-software-applications.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3217380662150918380/posts/default/7162288939938286621'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3217380662150918380/posts/default/7162288939938286621'/><link rel='alternate' type='text/html' href='http://ctechrockz.blogspot.com/2013/06/on-software-applications.html' title='On Software Applications.'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/15825313850821005204</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3217380662150918380.post-1237452633916062018</id><published>2013-05-30T00:48:00.000-07:00</published><updated>2013-06-24T10:34:18.867-07:00</updated><title type='text'>About Machine Language And High Level Languages.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;
Machine Language:&lt;/span&gt;&lt;/h2&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;The only language that can be understood by the computer hardware is the &lt;b&gt;Machine Language.&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;The instructions in machine language must&lt;b&gt; &lt;/b&gt;be in streams of 0&#39;s and 1&#39;s. Because the internal circuits of a computer are made up of switches, transistors, and other electronic devices that can be one of two states: &lt;b&gt;off &lt;/b&gt;or &lt;b&gt;on&lt;/b&gt;.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;The off state is represented by 0,and the on state by 1.&lt;/span&gt;&lt;/div&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;
High Level Language:&lt;/span&gt;&lt;/h2&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;The desire to improve programmer efficiency and to change the focus from the computer to the&amp;nbsp; problem being solved led to the development of &lt;b&gt;High Level Languages&lt;/b&gt;. They must be converted to machine language. The process of converting high level language to machine language is known as &lt;b&gt;Compilation&lt;/b&gt;. Each and every programming language uses a piece of software, called a &lt;b&gt;Compiler&lt;/b&gt; or an &lt;b&gt;Interpreter&lt;/b&gt;, to translate the program code into the machine language.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;The first widely used high level language is &lt;b&gt;FORTRAN-&lt;/b&gt;was created by John Backus and an IBM team in 1957; it is still widely used today in scientific and engineering applications.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;After the invention of FORTRAN, with in a short span of time &lt;b&gt;COBOL&lt;/b&gt;-was invented by Admiral Hopper.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;b&gt;FORTRAN-&lt;/b&gt;is an acronym for FORmula TRANslation.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;b&gt;COBOL-&lt;/b&gt;is an acronym for COmmon Business Oriented Language.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://ctechrockz.blogspot.com/feeds/1237452633916062018/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ctechrockz.blogspot.com/2013/05/about-machine-language-and-high-level.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3217380662150918380/posts/default/1237452633916062018'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3217380662150918380/posts/default/1237452633916062018'/><link rel='alternate' type='text/html' href='http://ctechrockz.blogspot.com/2013/05/about-machine-language-and-high-level.html' title='About Machine Language And High Level Languages.'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/15825313850821005204</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3217380662150918380.post-7704101199199270323</id><published>2013-04-25T11:57:00.002-07:00</published><updated>2013-06-24T10:33:59.689-07:00</updated><title type='text'>Input Output Operations getc() And putc() Of Files.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;The standard input/output library provides similar routines for file input/output as well as for standard input/output.&lt;/span&gt;&lt;br /&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;
getc() and putc()&lt;/span&gt;&lt;/h2&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;The two functions getc() and putc() are the most basic functions of C. They are used to read the character and to display the character.&lt;/span&gt;&lt;/div&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;
getc():&lt;/span&gt;&lt;/h2&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;The function getc() reads a character from a file referenced by file pointer opened in read mode using &lt;b&gt;fopen()&lt;/b&gt;. The syntax of getc() is: &lt;b&gt;int getc(File&#39;s pointer);&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;Example:&lt;b&gt; int getc(fp);&amp;nbsp;&lt;/b&gt; &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;getc() returns the next character on the given input stream and increments the stream&#39;s file pointer to the next character. It reaches EOF marker after reaching the end of&amp;nbsp; file.&lt;/span&gt;&lt;/div&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;
putc():&lt;/span&gt;&lt;/h2&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;The function putc() writes a character to the file which is opened by &lt;b&gt;fopen()&lt;/b&gt; in write mode.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;The syntax of putc() is: &lt;b&gt;int putc(int c,fp);&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;putc() outputs the character given by &#39;c&#39; to the file through the pointer &#39;fp&#39;. It returns the character &#39;c&#39; on success, that is, when a character is written to that particular which we have been opened. On error, the pointer will points towards end of the file(EOF).&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;The character input/output operations like &lt;b&gt;getchar()&lt;/b&gt;, and &lt;b&gt;putchar() &lt;/b&gt;will also work as similar to &lt;b&gt;getc(fp)&lt;/b&gt;,&lt;b&gt; &lt;/b&gt;and&lt;b&gt; putc(c,fp)&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;Example Program: &lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;A program code using getc(), and putc() operations.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;#include&amp;lt;conio.h&amp;gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;#include&amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;#include&amp;lt;stdlib.h&amp;gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;void main()&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;{&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;FILE *fp;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;int c;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;fp=fopen(&quot;cse.txt&quot;,&quot;r&quot;);&lt;/i&gt;&amp;nbsp; &lt;i&gt;// &lt;/i&gt;opens file &#39;cse&#39; in read mode.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;if(fp==NULL)&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;{&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;printf(&quot;cannot open the file&quot;);&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;exit(0);&amp;nbsp; &lt;/i&gt;&lt;i&gt;//&lt;/i&gt;terminates the program&lt;i&gt;.&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;} &lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;&amp;nbsp;c=getc(fp);&amp;nbsp; //&lt;/i&gt; reads a character and fp points to the next character.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;while(c!=EOF) // &lt;/i&gt;checks whether end of file reaches are not; if not the below code will executes.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;{&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;putchar(c); //&lt;/i&gt; prints a character &#39;c&#39; on the screen.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;c=getc(fp); //&lt;/i&gt; reads next character.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;}&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;fclose(fp); //&lt;/i&gt;closes the file which is referenced by the pointer fp.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;getch(); &lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;Explanation:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;In this program, the file named &lt;b&gt;cse.txt &lt;/b&gt;is opened in a read mode. Its contents are read character by character using &lt;b&gt;getc()&lt;/b&gt;, and then displayed on the screen. When the pointer reaches to EOF, then the while loop terminates and file will be closed using the function called &lt;b&gt;fclose()&lt;/b&gt;.&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
From site : http://ctechrockz.blogspot.com/&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://ctechrockz.blogspot.com/feeds/7704101199199270323/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ctechrockz.blogspot.com/2013/04/input-output-operations-getc-and-putc.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3217380662150918380/posts/default/7704101199199270323'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3217380662150918380/posts/default/7704101199199270323'/><link rel='alternate' type='text/html' href='http://ctechrockz.blogspot.com/2013/04/input-output-operations-getc-and-putc.html' title='Input Output Operations getc() And putc() Of Files.'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/15825313850821005204</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3217380662150918380.post-3348210893134945084</id><published>2013-04-21T12:35:00.002-07:00</published><updated>2013-06-24T10:33:07.518-07:00</updated><title type='text'>Opening And Closing A Data File.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;Files are not only used for data, but our programs are also stored in files. To work with a file, a program has to go through the following steps:&lt;/span&gt;&lt;br /&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;Open a file for reading or writing. &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;Do operation read or write to file using library functions.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;Close the file may be used by some other program.&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;The difference between working with file or with standard input/output terminals is that we must specify the location of file to work within our program.&lt;/span&gt;&lt;br /&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;
Opening a File:&lt;/span&gt;&lt;/h2&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;Specifying the file you wish to use is referred to as opening the file. When working with a stream oriented data file, the first step is to establish a &lt;b&gt;buffer area&lt;/b&gt;,where information is temporarily stored while being transferred between the computer&#39;s memory and the data file. The buffer area allows information to be read from or written to the data file more rapidly than would other wise be possible.&lt;/span&gt;&lt;/div&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;
Buffered input/output:&lt;/span&gt;&lt;/h2&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;A buffer is a region of memory used to temporarily hold data while it is being moved from one place to another. Typically the data is stored in buffer(i.e.memory location) as it is retrieved from an input device (such as a keyboard) or just before it is sent to an output device (such as monitor).&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;The buffer area is used using the pointer to FILE declared as:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;FILE *ptvar;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;where,&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;FILE (only uppercase letters should be required) is a special structure type that establishes the buffer area, and ptvar is a pointer variable that indicates the beginning of the buffer area(courser). It is often referred to as stream pointer, or simply a stream. The structure type FILE is defined within a system &lt;b&gt;include &lt;/b&gt;file, typically &lt;b&gt;stdio.h&lt;/b&gt;.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;A data file must be opened before it can be created or processed. A file is opened by call to function &lt;b&gt;fopen() &lt;/b&gt;which is available in library stdio.h. &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;The syntax of function fopen() is&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;ptvar=fopen(file name, file type);&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;where file name and file type are the stings that represent the name of the data file and the manner in which the data file will be utilised. It means that the file type is just a mode which specifies the purpose of opening a file; reading a file, or writing a file, or appending text at the end of the file(i.e.continuation of writing at the end of the file), etc.&lt;b&gt; &lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;The name chosen for the file must be consistent with the rules for naming files, as determined by the computer&#39;s operating system.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;The function returns a pointer to the object which controls the stream associated with the file, that is, the pointer to the beginning of buffer area associated with the file(if the file is opened successfully), otherwise it returns a NULL value which is defined in stdio.h.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;For example:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;#include&amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;void main()&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;{&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;FILE *fp;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;fp=fopen(&quot;cse.txt&quot;,&quot;r&quot;);&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;}&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;The above program will open a file &quot;cse.txt&quot; for reading. If no file exists with this name in the current directory, then the function will return NULL value, indicating no valid buffer is associated within the file.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;Considering another example:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;#include&amp;lt;&lt;/i&gt;&lt;i&gt;stdio.h&amp;gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;void main()&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;{&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;FILE *fp;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;fp=fopen(&quot;cse.txt&quot;,&quot;w&quot;);&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;}&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;The above code will open a file named &quot;cse.txt&quot; for writing.&lt;i&gt; &lt;/i&gt;If the file does not exists within the given path, then the function will create a new file and opens it to write. If the file already exists, then it will be opened in write mode but the previous contents will be deleted.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;Every file has its own pointer variable. When we wish to read from a file or write to a file, we specify the file pointer variables as &lt;b&gt;FILE&lt;/b&gt; &lt;b&gt;*fp1, *fp2, *fp3;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;The variables fp1,fp2, and fp3 are file pointers.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;Example for a NULL pointer:&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;#include&amp;lt;&lt;/i&gt;&lt;i&gt;stdio.h&amp;gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;#include&amp;lt;conio.h&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;#include&amp;lt;stdlib.h&amp;gt; &amp;nbsp; //&lt;/i&gt;prototype for exit function&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;void main()&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;{&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;FILE *fp;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;fp=fopen(&quot;cse.txt&quot;,&quot;w&quot;);&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;if(fp==NULL)&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;{&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;printf(&quot;cannot open the file&quot;);&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;exit(0);&amp;nbsp; &lt;/i&gt;&lt;i&gt;//&lt;/i&gt;terminates the program&lt;i&gt;.&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;} &lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;//here we can work on file(i.e. write to a file)..&lt;/span&gt;&lt;br /&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;}&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;If fopen() returns NULL, we can check whether the file is opened or not and accordingly print the message in to the file.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;We can also combine the fopen() and if statements as follows:&lt;/span&gt;&lt;br /&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;if((fp=fopen(&quot;cse.txt&quot;,&quot;w&quot;))==NULL)&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;printf(&quot;cannot open the file&quot;);&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;exit(0); &lt;/i&gt;&lt;i&gt;//&lt;/i&gt;terminates the program&lt;i&gt;.&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;
Closing a File:&lt;i&gt; &lt;/i&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;When all read, write, and other operations are done with an opened file, it must be closed immediately for the following reasons:&lt;/span&gt;&lt;/div&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;To reopen it in some other mode.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;To prevent any misuse with the file.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;To make the operations you have performed on the files successful.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;To close a file, we must use the function named &lt;b&gt;fclose()&lt;/b&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;The syntax of fclose() is as follows:&lt;/span&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;fclose(ptvar)&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;where ptvar is a pointer variable(fp).&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;The function fclose() closes the named stream. Pointer variable points to a file to be closed. All buffer associated with the stream are flushed before closing the file. On success, fclose() returns 0 otherwise, it returns end-of-function.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;Example program:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;A program code which demonstrates the functions fopen() and fclose().&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;#include&amp;lt;&lt;/i&gt;&lt;i&gt;stdio.h&amp;gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;#include&amp;lt;conio.h&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;#include&amp;lt;stdlib.h&amp;gt; &amp;nbsp; //&lt;/i&gt;prototype for exit function&lt;i&gt;.&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;void main()&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;{&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;FILE *fp;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;clrscr();&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;fp=fopen(&quot;cse.txt&quot;,&quot;w&quot;);&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;if(fp==NULL)&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;{&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;printf(&quot;cannot open the file&quot;);&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;exit(0); //&lt;/i&gt;terminates the program&lt;i&gt;.&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;}&amp;nbsp;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;else&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;{ &lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;printf(&quot;File is opened successfully&quot;);&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;printf(&quot;\n Now you can work on your file in write mode&quot;);&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;}&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;if(fclose(fp)==0)&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;{&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;printf(&quot;\n File is closed now. cannot work on file&quot;);&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;}&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;getch();&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;}&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;Output for the above given program:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;File is opened &lt;/i&gt;&lt;i&gt; successfully&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;Now you can work on your file in write mode&lt;/i&gt; &lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;File is closed now. cannot work on file&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;How the above program works?&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;In the above code, a file named &lt;i&gt;&quot;cse.txt&quot; &lt;/i&gt;is opened. The if condition checks whether file is opened or not. If the file is not opened, it prints the message &lt;i&gt;&quot;cannot open the file&quot; &lt;/i&gt;and terminates the program. If the file is opened, it prints the corresponding message. The condition &lt;i&gt;fclose(fp)==0 &lt;/i&gt;checks whether the file pointed to by &lt;i&gt;fp&lt;/i&gt; is closed successfully or not. &lt;/span&gt;&lt;/div&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;i&gt;&amp;nbsp;&lt;/i&gt;Note: A file pointer is simply a variable like an integer or a character. It does not point to a file or the data in a file; it is simply used to indicate which file refers to the input/output operations.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;From site : http://ctechrockz.blogspot.com/&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://ctechrockz.blogspot.com/feeds/3348210893134945084/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ctechrockz.blogspot.com/2013/04/opening-and-closing-data-file.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3217380662150918380/posts/default/3348210893134945084'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3217380662150918380/posts/default/3348210893134945084'/><link rel='alternate' type='text/html' href='http://ctechrockz.blogspot.com/2013/04/opening-and-closing-data-file.html' title='Opening And Closing A Data File.'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/15825313850821005204</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3217380662150918380.post-7230007922360857916</id><published>2013-04-20T06:15:00.002-07:00</published><updated>2013-06-25T23:48:04.036-07:00</updated><title type='text'>Introduction To File Handling.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&amp;nbsp;We normally often need to store data through our programs on some permanent storage devices so that we are able to access the data some other time. Such a data is stored on the memory device in the form of a data file. Thus,data files allow us to store information permanently, and to access and alter that information whenever necessary. The C library provides set of library functions to perform read and write operations on files. A computer file is a collection of data stored on a non volatile device in a computer system. Files exists on permanent storage devices, such as hard disks, DVDs, USB drives, and reels of magnetic tape.&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;There are two different&amp;nbsp; types of data files, called stream oriented (or) standard data files and the system oriented (or) low level data files.&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&amp;nbsp;Stream oriented data files are generally easier to work with and are therefore more commonly used. These files are sub divided into two categories: The first category is of text files, that which consists of consecutive characters. These characters can be interpreted as strings or numbers or-else individual data items. The manner in which these characters&amp;nbsp; are interpreted will use library functions such as scanf and printf statements etc. The second is often referred to as unformulated data files. They organizes data into blocks containing contiguous bytes of information. These blocks represent more complex data structures, such as arrays and structures. A separate set of library functions are available for processing stream oriented data files of this type.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&amp;nbsp;System oriented data files are more closely related to the computer&#39;s operating system than stream oriented. They are somewhat more complicated to work with, though their use may be more efficient for certain kind of applications.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&amp;nbsp;Data files are most frequently used to store user&#39;s data. However data related to numbers can be efficiently stored in the form of binary files, which are also useful to handle file containing machine language contents. The files which are stored in binary format differ significantly from data(i.e.text files).&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;b&gt;Text Files;&lt;/b&gt;which contain data that can be read in a text editor because the data has been encoded using a scheme such as ASCII or uni-code. Text files might include facts and figures used by business programs, such as a payroll file that contains employee numbers, names, and salaries.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;b&gt;Binary file;&lt;/b&gt;which contain data that has not been encoded as text. It mean that the binary file always contains binary digits. Examples include images and music.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; Although their contents vary, files have many common characteristics, as follows:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;A &lt;b&gt;byte&lt;/b&gt; is a small unit of storage; for example, in a simple text file, a byte holds only one character. Because a byte is so small. File sizes usually expressed in kilo bytes(thousands of bytes), mega bytes(millions of bytes), giga bytes(billions of bytes).&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; The C language treats all the information that enters a program or leaves a program as a stream of bytes or series of bytes. We can work on files by using input or output streams. &lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;
For a quick summery, visit&amp;nbsp; the below given link.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;http://ctechrockz.blogspot.in/2013/04/an-overview-of-files.html&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;
From site : http://ctechrockz.blogspot.com/&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://ctechrockz.blogspot.com/feeds/7230007922360857916/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ctechrockz.blogspot.com/2013/04/introduction-of-file-handling.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3217380662150918380/posts/default/7230007922360857916'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3217380662150918380/posts/default/7230007922360857916'/><link rel='alternate' type='text/html' href='http://ctechrockz.blogspot.com/2013/04/introduction-of-file-handling.html' title='Introduction To File Handling.'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/15825313850821005204</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3217380662150918380.post-3580689545498258749</id><published>2013-04-20T05:35:00.000-07:00</published><updated>2013-06-24T10:29:57.227-07:00</updated><title type='text'>An Overview Of Files.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;
What is a File?&lt;/span&gt;&lt;/h2&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;A &lt;b&gt;File &lt;/b&gt;is a collection of related records such as the records of employee in a company. Each record will be a collection of related data items called fields namely, employer name, number, department etc..Each field consists of group of characters. Many computer applications require that information must be written or read from an auxiliary device such as hard disk or floppy disk. Such a information&amp;nbsp; will be stored in the storage devices in the form of data files.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Data files allow us to store information permanently, and access or alter that information whenever required.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;
&amp;nbsp;How a File will be useful?&lt;/span&gt;&lt;/h2&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif; font-weight: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; There can be many reasons to use files. &lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;/ul&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;The first and the foremost reason is need of permanency of storage of data. If we want to preserve the output of any program for future use, it is not possible with out files. All the inputting files have been printed with the help of any output statements like printf, putchar etc..are never available for future use and the only solution in that case is to write the output in files.Similarly, if there is a large amount of data generated as output by a program, storing that output in file will help in easy analysis of the output,as user can see the whole output at any time even after complete execution of the program. These situations will explain the need of output files.&amp;nbsp; &lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;The input files are also equally important and useful. If a program needs a lot of data to be inputted, user cannot keep on typing that again again for repeated execution of the program. In that case, all input data can be once written in a file and then that file can be easily used as the input file. Moreover the transfer of input data and/or the output data from one computer to another can be easily done by using files.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; From site : http://ctechrockz.blogspot.com/&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://ctechrockz.blogspot.com/feeds/3580689545498258749/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ctechrockz.blogspot.com/2013/04/an-overview-of-files.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3217380662150918380/posts/default/3580689545498258749'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3217380662150918380/posts/default/3580689545498258749'/><link rel='alternate' type='text/html' href='http://ctechrockz.blogspot.com/2013/04/an-overview-of-files.html' title='An Overview Of Files.'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/15825313850821005204</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3217380662150918380.post-2177420715066197020</id><published>2013-04-17T12:43:00.004-07:00</published><updated>2013-06-24T10:32:33.197-07:00</updated><title type='text'>A Basic Introduction To Programming Languages.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;
Programming Languages:&lt;/span&gt;&lt;/h2&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;A Programming Language&amp;nbsp; is a language that can be used to write computer programs which controls the functionality or behavior of a computer. A Programming Language is not a spoken language. It is a way of describing what the programmer wants the computer to do. In fact every programming language is defined by the syntactic and semantic rules which describes the whole language. Thousands of different languages are created so far and many new languages are created every year. Suppose you want to solve an equation but&amp;nbsp; you don&#39;t know the steps included in it, in this case you will find very difficult to solve such a problem. Similarly if you want your computer to solve that problem, your computer must know the steps involving to solve it. These steps are provided by you as instructions to the computer as programs written in a particular programming languages. A computer program is also called as a piece of code or source code and the actual writing of source code is called coding.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;Every Programming Language has rules governing its word usage and punctuation. These rules are called the &lt;b&gt;language&#39;s syntax&lt;/b&gt;. Unless the syntax is correct, the computer cannot interpret the programming language instructions at all.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;When you write a program, you usually type its instructions using a keyboard. When you type the program instructions, they are stored in computer&#39;s memory, which is a temporarily internal storage device. It is known-ed to be volatile, since its contents are lost when the computer is turned off or when the power is loosed. Such that you need to store them on a permanent storage devices like hard disks. These are known-ed to be non-volatile, since their contents are persistent and are retained when the power is lost. After storing a program, it must be translated from your programming language statement to machine language statement. &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
From site : http://ctechrockz.blogspot.com/&amp;nbsp; &lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://ctechrockz.blogspot.com/feeds/2177420715066197020/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ctechrockz.blogspot.com/2013/04/a-basic-introduction-to-programming.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3217380662150918380/posts/default/2177420715066197020'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3217380662150918380/posts/default/2177420715066197020'/><link rel='alternate' type='text/html' href='http://ctechrockz.blogspot.com/2013/04/a-basic-introduction-to-programming.html' title='A Basic Introduction To Programming Languages.'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/15825313850821005204</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3217380662150918380.post-3380927945909087950</id><published>2013-04-17T05:23:00.000-07:00</published><updated>2013-06-24T10:31:05.836-07:00</updated><title type='text'>Introduction To Computer Systems.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Georgia, &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;&amp;nbsp;&lt;span style=&quot;font-size: large;&quot;&gt;A Basic Introduction To Computer Systems:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, &amp;quot;Times New Roman&amp;quot;, serif; font-size: small;&quot;&gt;Welcome to computer science. You are in a world which offers many challenges and exciting careers.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Georgia, &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;Here, we introduce you to the concepts which are dealing with computer science and especially about programming, coding, and the languages which are understood by the computers. A computer system is a combination of all the components required&amp;nbsp; to process and store data using computer. Each and every system is composed with multiple pieces of&lt;b&gt; Hardware &lt;/b&gt;and&lt;b&gt; Software&lt;/b&gt;. &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Georgia, &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Hardware:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, &amp;quot;Times New Roman&amp;quot;, serif; font-size: small;&quot;&gt;Hardware is a physical device which is associated with a computer&lt;b&gt;. &lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Georgia, &amp;quot;Times New Roman&amp;quot;, serif; font-size: small;&quot;&gt;Devices like keyboards, mice, speakers, and printers are all hardware devices. The hardware components of the computer systems are divided in to three parts:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, &amp;quot;Times New Roman&amp;quot;, serif; font-size: small;&quot;&gt;1.Input devices&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, &amp;quot;Times New Roman&amp;quot;, serif; font-size: small;&quot;&gt;2.Storage devices&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, &amp;quot;Times New Roman&amp;quot;, serif; font-size: small;&quot;&gt;3.Output devices&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, &amp;quot;Times New Roman&amp;quot;, serif; font-size: small;&quot;&gt;Keyboard is considered to be as an input device.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, &amp;quot;Times New Roman&amp;quot;, serif; font-size: small;&quot;&gt;Storage device is of Central Processing Unit(CPU).&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, &amp;quot;Times New Roman&amp;quot;, serif; font-size: small;&quot;&gt;Primary storage devices are like pen drives,disks,and taps etc.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, &amp;quot;Times New Roman&amp;quot;, serif; font-size: small;&quot;&gt;Monitors and Printers are of output devices.&lt;/span&gt;&lt;/div&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Georgia, &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Keyboard:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, &amp;quot;Times New Roman&amp;quot;, serif; font-size: small;&quot;&gt;Keyboard is a device in which programs and data to be entered into the computer. Other examples of input devices include a touch screen, stylus or a pen, an audio input unit, and a writing note pad.&lt;/span&gt;&lt;/div&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Georgia, &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;CPU:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, &amp;quot;Times New Roman&amp;quot;, serif; font-size: small;&quot;&gt;Central processing unit is responsible for executing arithmetic calculations. Primary storage device is considered to be as main memory, since it is a place in which programmers can store the programs and data temporarily during processing. It can be erased if we turn off the system. Since it is stored in RAM(Random Accessing Memory). Auxiliary storage device is considered as a secondary storage device, which is used for both input and output. It is a place where the programs are stored permanently. When we turn off the computer, our programs and data will be stored in secondary storage devices like hard disks, and pen drives.&lt;/span&gt;&lt;/div&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Georgia, &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Monitors and Printers:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, &amp;quot;Times New Roman&amp;quot;, serif; font-size: small;&quot;&gt;Output devices are usually monitors and printers that which shows the output. The shown output or the displayed output on the screen of the monitor will be considered to be as a soft copy. If we prints on a printer, then the output printed copies are of hard copies.&lt;/span&gt;&lt;/div&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Georgia, &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Software:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, &amp;quot;Times New Roman&amp;quot;, serif; font-size: small;&quot;&gt;Software is computer&#39;s instructions that tells the hardware what to do. Simply we can say that the software is a programs instructions written by a programmer. There can be a plenty of p rewritten programs which are stored in a disk. Also it can be available to buy by the users and it can be downloaded from the WEB.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, &amp;quot;Times New Roman&amp;quot;, serif; font-size: small;&quot;&gt;Side by side we can also write our own programs, which is known-ed to be as coding the program or programming. This site mainly focuses on the coding the programs or the programming process and the logic which are used to write a program.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, &amp;quot;Times New Roman&amp;quot;, serif; font-size: small;&quot;&gt;Software can be classified in to two categories:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, &amp;quot;Times New Roman&amp;quot;, serif; font-size: small;&quot;&gt;The system software, and the Application software.&lt;/span&gt;&lt;/div&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, &amp;quot;Times New Roman&amp;quot;, serif; font-size: small;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;System software:&lt;/span&gt; &lt;/span&gt;&lt;/h2&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, &amp;quot;Times New Roman&amp;quot;, serif; font-size: small;&quot;&gt;System software comprises the programs that you use to manage your system or a computer, including operating systems such as Windows, LINUX, or UNIX.&lt;/span&gt;&lt;/div&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, &amp;quot;Times New Roman&amp;quot;, serif; font-size: small;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Software applications :&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, &amp;quot;Times New Roman&amp;quot;, serif; font-size: small;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Software applications comprises all the&amp;nbsp;programs you apply to a task. Which are of like word processing programs, spread sheets, payroll, and inventory programs, and also even games.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, &amp;quot;Times New Roman&amp;quot;, serif; font-size: small;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
From site : http://ctechrockz.blogspot.com/&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://ctechrockz.blogspot.com/feeds/3380927945909087950/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ctechrockz.blogspot.com/2013/04/introduction-to-computer-systems.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3217380662150918380/posts/default/3380927945909087950'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3217380662150918380/posts/default/3380927945909087950'/><link rel='alternate' type='text/html' href='http://ctechrockz.blogspot.com/2013/04/introduction-to-computer-systems.html' title='Introduction To Computer Systems.'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/15825313850821005204</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>