<?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 Derived Data Types</title>
	<atom:link href="http://www.fresherstimes.com/india/c-derived-data-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>Derived Data Types in C Programming Language</title>
		<link>http://www.fresherstimes.com/tutorial/c-programming/derived-data-types-c-language/</link>
		<comments>http://www.fresherstimes.com/tutorial/c-programming/derived-data-types-c-language/#comments</comments>
		<pubDate>Mon, 25 Jan 2010 19:51:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[C Programming]]></category>
		<category><![CDATA[C Derived Data Types]]></category>
		<category><![CDATA[Derived Data Type C Programming]]></category>

		<guid isPermaLink="false">http://www.fresherstimes.com/?p=7870</guid>
		<description><![CDATA[Derived Data Types in C Language
Derived data types in C Programming Language are those C data types which are derived from the fundamental data types using some declaration operators.
Now, in this tutorial we will be discussing each of these derived data types in brief as we will again come across these topics in the next [...]]]></description>
			<content:encoded><![CDATA[<h3 style="text-align: center;">Derived Data Types in C Language</h3>
<p><em><strong>Derived data types</strong></em> in C Programming Language are those <em><strong><a title="Data Types in C Language" href="http://www.fresherstimes.com/tutorial/c-programming/c-language-data-types/" target="_blank">C data types</a></strong></em> which are derived from the fundamental data types using some declaration operators.</p>
<p>Now, in this tutorial we will be discussing each of these derived data types in brief as we will again come across these topics in the next coming up sections.</p>
<p>1. <span style="text-decoration: underline;"><strong>Arrays:</strong></span><br />
Arrays can be defined as a set of finite and homogeneous data elements. Each element of an array is referenced using an index.</p>
<p>For example:<br />
If we the name of an array is AR which have 5 elements then the array will be represented as :<br />
<em>AR[0], AR[1], AR[2], AR[3], AR[4]</em><br />
Here, these subscripts which are containing the digit is known as an index.<img title="More..." src="http://www.fresherstimes.com/wp-includes/js/tinymce/plugins/wordpress/img/trans.gif" alt="" /><span id="more-7870"></span></p>
<p>There are various types of arrays namely:</p>
<ul>
<li> One dimensional</li>
<li> Two dimensional</li>
<li> Multi dimensional</li>
</ul>
<p>The elements of an array are indexed from 0 to size-1. It is necessary to declare the size of an array before initialization. An array can be initialize by placing the elements of an array within the curly braces.</p>
<p>For example, an array initialization can be done in following manner:</p>
<blockquote><p>int AR[5] = {5, 2, 6, 8, 3};</p></blockquote>
<p><strong>A sample program of an array:</strong></p>
<blockquote><p>#include<br />
Void main()<br />
{<br />
int arr[10];<br />
arr[10] = {1,5,4,6,3,9,14,81,7,11};<br />
printf(“\n %d”,arr[i]);<br />
}</p></blockquote>
<p>2. <span style="text-decoration: underline;"><strong>Functions:</strong></span><br />
A function can be defined as a part of the program which is declared by the programmer in any part of the program and a function can be of any name depending upon the choice of the programmer. The function declared can be invoked from other part of the program.</p>
<p><strong>Example of a function:</strong></p>
<blockquote><p>#include<br />
Float square(float);<br />
Void main()<br />
{<br />
Float num=3.14;<br />
Float sq;<br />
Sq=square(num);<br />
Printf(“%f”,sq);<br />
}</p>
<p>Float square(float x)<br />
{<br />
Return x * x;<br />
}</p></blockquote>
<p>The above code will print the square of the above given number. square is the name of the function used. And sq is the variable used to store the value of the square. The use of the function before the main function is known as declaration of the function, then comes the definition of a function which takes place outside the main function. Then finally comes the calling of the function which takes place inside the main function.</p>
<p>3. <span style="text-decoration: underline;"><strong>Pointers:</strong></span><br />
A pointer is a variable that holds the address of the memory space. We can say that if one variable can hold the address of the another variable then it is said that the first variable is pointing to the second.</p>
<p>A pointer is declared in a following manner:</p>
<blockquote><p>int *temp;</p></blockquote>
<p>i.e. first we have to declare the type and then the variable name precede by an * (asterisk) sign.</p>
<p>The pointer variable always occupies 2 bytes of memory.</p>
<p>4. <span style="text-decoration: underline;"><strong>Structures:</strong></span><br />
A Structure can be defined as a collection or a group of variables that are referenced under one name. it is used to keep related information together. Here we use a <em><strong>‘struct’</strong></em> <em><strong><a title="Keywords in C Programming Language" href="http://www.fresherstimes.com/tutorial/c-programming/c-language-keywords/" target="_blank">keyword</a></strong></em> to construct a structure.</p>
<p>Example:</p>
<blockquote><p>Struct bank<br />
{<br />
Char name[30];<br />
Int account_no;<br />
Int amount;<br />
};</p>
<p>Struct b;</p></blockquote>
<p>In the above example bank is the name of the structure, then we have declared the variables which are the elements of this structure. And b is the object of the structure which is used to refer the elements of the <em><strong><a title="Basic Program Structure in C" href="http://www.fresherstimes.com/tutorial/c-programming/c-program-structure/" target="_blank">structure</a></strong></em>.</p>
<p>Elements will be referred as :</p>
<p><em>b.amount=5000;<br />
b.account_no=2546321;</em></p>
<p>5. <span style="text-decoration: underline;"><strong>Class:</strong></span><br />
A class can be defined as a group of objects which are similar or of the same kind. Here a keyword ‘class’ is used to construct a class. A Class almost follows the same declaration procedure as we did in case of structures. But here comes the concept of access specifiers which applies a kind of restriction on the data. There are three types of access specifiers namely public, protected and private.</p>
<p>Example of a class:</p>
<blockquote><p>Class student<br />
{<br />
Char name[20];<br />
Int roll_no;<br />
Public:<br />
Details();<br />
Display();<br />
};</p></blockquote>
<blockquote><p>Student stud;</p></blockquote>
<p>In the above example the student is the name of the class, and stud is the name of the object. Here two functions details and display are called member functions.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fresherstimes.com/tutorial/c-programming/derived-data-types-c-language/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

