<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Freshers Times &#187; C Variable Types</title>
	<atom:link href="http://www.fresherstimes.com/india/c-variable-types/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.fresherstimes.com</link>
	<description>Freshers Jobs n Entry Level Careers in India</description>
	<lastBuildDate>Tue, 25 May 2010 16:41:02 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Variable Types in C Programming Language</title>
		<link>http://www.fresherstimes.com/tutorial/c-programming/variable-types-c-language/</link>
		<comments>http://www.fresherstimes.com/tutorial/c-programming/variable-types-c-language/#comments</comments>
		<pubDate>Tue, 26 Jan 2010 05:48:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[C Programming]]></category>
		<category><![CDATA[c programming variable types]]></category>
		<category><![CDATA[C Variable Types]]></category>

		<guid isPermaLink="false">http://www.fresherstimes.com/?p=7876</guid>
		<description><![CDATA[Variable Types in C Programming Language
Variables are names which are declared in order to store a single value that can either be an integer or a character. It is must to declare the type of the variable also i.e int, char etc. Generally there are two types of variables namely :

 Global variables
 Local variables

These [...]]]></description>
			<content:encoded><![CDATA[<h3 style="text-align: center;">Variable Types in C Programming Language</h3>
<p style="text-align: justify;">Variables are names which are declared in order to store a single value that can either be an integer or a character. It is must to declare the type of the variable also i.e int, char etc. Generally there are two types of variables namely :</p>
<ol>
<li> Global variables</li>
<li> Local variables</li>
</ol>
<p>These variables are classified on the basis of their place of declaration.<span id="more-7876"></span></p>
<h3>Global Variables:</h3>
<ul>
<li> If a variable is declared outside all the functions, then it is said to be <em><strong>global variable</strong></em>.</li>
<li>A global variable is available to all the functions and each part of the program.</li>
<li>When a program is executed then a global variable comes into consideration.</li>
<li>A global variable is destroyed when the program is terminated.</li>
<li>Global variables can be accessed from any part of the file or program.</li>
</ul>
<p><span style="text-decoration: underline;"><strong>Example:</strong></span></p>
<blockquote><p>#include<br />
int a;<br />
int b;<br />
char ch;<br />
void main()<br />
{<br />
printf(“\n enter the numbers :”);<br />
scanf(“%d%d”,a,b);<br />
printf(“\n enter the character”);<br />
scanf(“%c”,ch);<br />
}</p></blockquote>
<p style="text-align: justify;">Now from the above example we can see that ‘a’ and ‘b’ are integer variables and ‘ch’ is a character variable which is declared outside the main function. Therefore, these variables are known as global variables. These variables can be accessed from any part of the program.</p>
<h3><strong>Local Variables:</strong></h3>
<ul>
<li>Local variables are the ones that are defined within a function.</li>
<li>A local variable comes into existence when any function is entered.</li>
<li>A local variable is terminated when we exits from the function.</li>
<li>These variables cannot be accessed from outside the function.</li>
<li>A local variable needs to be declared every time after the function call.</li>
</ul>
<p><span style="text-decoration: underline;"><strong>Example:</strong></span></p>
<blockquote><p>#include<br />
int  main()<br />
{<br />
int i;<br />
int j;<br />
int add(i,j);<br />
}<br />
int add(int x , int y)<br />
{<br />
int result;<br />
result = x + y;<br />
printf(“%d the result is:”,result);<br />
return result;<br />
}</p></blockquote>
<p style="text-align: justify;">Now from the above code we can see that all the variables are declared within the function and these variables will be executed when we enter any function. Therefore, these variables are not allowed to be accessed from any part of the code.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fresherstimes.com/tutorial/c-programming/variable-types-c-language/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

