<?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>C-C++ Programming Encyclopedia</title>
	<atom:link href="http://www.c-cplusplus.com/feed" rel="self" type="application/rss+xml" />
	<link>http://www.c-cplusplus.com</link>
	<description>Learn C Programming - C++ Tutorials &#124; Code Snippets &#124; FAQs</description>
	<lastBuildDate>Tue, 15 May 2012 09:40:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>CFA vs MBA &#8211; What&#8217;s the Right Option for You?</title>
		<link>http://www.c-cplusplus.com/cfa-vs-mba</link>
		<comments>http://www.c-cplusplus.com/cfa-vs-mba#comments</comments>
		<pubDate>Tue, 15 May 2012 09:37:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PMP Certification]]></category>
		<category><![CDATA[cfc]]></category>
		<category><![CDATA[cfc vs mba]]></category>
		<category><![CDATA[mba]]></category>

		<guid isPermaLink="false">http://www.c-cplusplus.com/?p=384</guid>
		<description><![CDATA[Students worldwide often get trapped in the dilemma of choosing the right option between CFA vs MBA while making a career choice. They often wonder if they should try to get through an intense exam, which requires countless hours of serious preparation or should they otherwise spend couple of years in a reputed business school. [...]]]></description>
			<content:encoded><![CDATA[<p>Students worldwide often get trapped in the dilemma of choosing the right option between <a href="http://www.c-cplusplus.com/cfa-vs-mba">CFA vs MBA</a> while making a career choice. They often wonder if they should try to get through an intense exam, which requires countless hours of serious preparation or should they otherwise spend couple of years in a reputed business school.<br />
<a href="http://www.c-cplusplus.com/wp-content/uploads/2012/05/CFA-vs-MBA.jpg"><img src="http://www.c-cplusplus.com/wp-content/uploads/2012/05/CFA-vs-MBA-300x165.jpg" alt="CFA vs MBA" title="CFA vs MBA" width="300" height="165" class="alignnone size-medium wp-image-385" /></a><br />
Well, the answer is simple, but only for those who have a clearer future plan and knows his/her strengths well enough. It totally depends on where you want to be, few years down the line, and what has your area of expertise been, in the recent times. It is important to know these two as CFA is good for certain kinds of industries and same holds good for MBA.<br />
<br />
<strong>International Recognition</strong><br />
<br />
Let us first see how much and where these two degree are recognised internationally. European countries and US are all about MBA graduates thanks to a long list of reputed business schools that they have.<br />
<br />
Other parts like India, South Africa, East Asia and few other emerging markets see CFA and MBA equally most of the times. You are likely to see qualification requirement as &#8220;MBA or CFA&#8221; in most of their job requirement ads. Now, if the place of work is a deciding factor then you can probably make a decision here itself. If not then, we can go little further with this discussion.<br />
<br />
<strong>Pros and Cons of MBA</strong><br />
<br />
MBA gives you direct exposure to recruiters at big consulting firms, various finance firms and banking sector. You also manage to have a very strong network and get a knack of evaluating business strategies; not to mention your soft skills get improved dramatically, which is a must in business world. </p>
<p>On the downside the best of MBA programs demand full time of your 2 years and you can not really work as full timer and still pursue MBA degree from a coveted business school. It might not turn out to be a big career boost if you are already from business or finance background. To top it all you need to spend over $150,000 as tuition and opportunity cost. Now that is a massive amount.<br />
<br />
<strong>Pros and Cons of CFA</strong><br />
<br />
You get easy entry in the field of equity research and portfolio management as CFA is almost a must in these fields. On completion of the course you become an expert in specialized knowledge, which gives you great recognition in finance sector. The best part is you need not sacrifice your full time work to study the course; in fact you can give the exams while working as a full timer.<br />
<br />
That being said, it definitely takes over 1000 hours of hard work to get through all the 3 levels, so you are hardly left with any free time. Building network can only start after you get into a CFA Society. The value of CFA is limited to finance, outside which it might not fetch you much.<br />
<br />
<strong>The Bottom-Line</strong><br />
<br />
So from the above discussion it&#8217;s quite evident that deciding between <strong>CFA vs MBA</strong> should not be a big dilemma for a student as they are vastly different from each other in almost all the possible ways. The only similarity probably is that they both can be pursued as post graduation.<br />
<br />
Finally, it boils down to what you want to be and where you want to be in few years. Another big deciding factor can be the huge cost difference between the two. While enrolling and exam fees for CFA should not cost more than $2,200, MBA can cost you over $150,000.<br />
<br />
So, we&#8217;d recommend <strong>CFA</strong> to those who&#8217;re looking for a quick recognition without spend a lot of money, and <strong>MBA</strong> to those who&#8217;re serious about building their career in the management field.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.c-cplusplus.com/cfa-vs-mba/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tricky C Programming Interview Questions</title>
		<link>http://www.c-cplusplus.com/c-programming-interview-questions</link>
		<comments>http://www.c-cplusplus.com/c-programming-interview-questions#comments</comments>
		<pubDate>Tue, 03 Jan 2012 22:19:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Basics]]></category>

		<guid isPermaLink="false">http://www.c-cplusplus.com/?p=381</guid>
		<description><![CDATA[There are many companies carrying out projects on C platform. If you have to face an interview in C-programming, it doesn’t mean that you will be working purely on that platform. But, the fact is that the interviewer will be checking your programming skills based on how you face the interview. Since C-programming is the [...]]]></description>
			<content:encoded><![CDATA[<p>There are many companies carrying out projects on C platform. If you have to face an interview in C-programming, it doesn’t mean that you will be working purely on that platform.<br />
<br />
<a href="http://www.c-cplusplus.com/wp-content/uploads/2012/01/c-programming-questions.jpg"><img src="http://www.c-cplusplus.com/wp-content/uploads/2012/01/c-programming-questions.jpg" alt="c programming questions" title="c programming questions" width="201" height="251" class="alignleft size-full wp-image-382" /></a>But, the fact is that the interviewer will be checking your programming skills based on how you face the interview. Since C-programming is the basic of all programming languages, they expect every technical student to be aware of the basic programming skills.<br />
<br />
Here are some of the commonly asked C Programming interview questions &#8211;<br />
<br />
1. Under basics of C, there are chances of asking the difference between declaration and definition of a variable.<br />
<br />
2. Do you think the Global variables will start out as zero?<br />
<br />
3. Does C have boolean variable type?<br />
<br />
4. Where are the variables defined in C?<br />
<br />
5. What does the term storage class refer to?<br />
<br />
6. What do you mean by auto, static, volatile, extern, const classes?<br />
<br />
7. Do you know anything about typedef keyword?<br />
<br />
8. Difference between constants defined through #define and constant keyword?<br />
<br />
9. What do you mean by Trigraph characters?<br />
<br />
10. How the floating point numbers are stored? What do you mean by IEEE format?<br />
<br />
11. When do you think the register modifier will be used?<br />
<br />
12. When will you use a type cast?<br />
<br />
13. Can structures be assigned to variables and passed to and from functions?<br />
<br />
Additionally, be prepared to answer questions on pointers, < malloc > or < calloc> functions, and constructors/destructors if the interviewers jumps on to C++</p>
]]></content:encoded>
			<wfw:commentRss>http://www.c-cplusplus.com/c-programming-interview-questions/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Operators in C Programming</title>
		<link>http://www.c-cplusplus.com/operators-in-c-programming</link>
		<comments>http://www.c-cplusplus.com/operators-in-c-programming#comments</comments>
		<pubDate>Thu, 15 Dec 2011 12:22:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Run C Program Online]]></category>
		<category><![CDATA[Operators in C Programming]]></category>

		<guid isPermaLink="false">http://www.c-cplusplus.com/?p=378</guid>
		<description><![CDATA[In C programming language, one can find various operators for performing different kind of operations. There are operators for arithmetic functions, assignment, logical functions, and others. Operators in C language work on constants and variables, though few are restricted for certain works. Most of the operators are binary; few operators are unary and that takes [...]]]></description>
			<content:encoded><![CDATA[<p>In C programming language, one can find various operators for performing different kind of operations. There are operators for arithmetic functions, assignment, logical functions, and others.<br />
<br />
<strong>Operators in C language</strong> work on constants and variables, though few are restricted for certain works. Most of the operators are binary; few operators are unary and that takes only one operand.<br />
<br />
<strong>Arithmetic Operators</strong><br />
<br />
Arithmetic operators are used for addition (+), multiplication (*), subtraction (-), and division operations. In addition to these arithmetic operators, there is a modulus operator to give the remainder from the division operator.<br />
<br />
<strong>Sample Code</strong><br />
<br />
1.	 #include <stdio.h><br />
2.<br />
3.	Void main()<br />
4.	 {<br />
5.	         int x = 200;<br />
6.	         int y = 4;<br />
7.	         int z;<br />
8.<br />
9.	         z = x + y;<br />
10.	         printf( &#8220;x + y = %dn&#8221;, z );<br />
11.<br />
12.	         c = a &#8211; b;<br />
13.	         printf( &#8220;x &#8211; y = %dn&#8221;, z );<br />
14.<br />
15.<br />
16.	         printf( &#8220;x * y = %dn&#8221;, x* y );<br />
17.<br />
18.	         c = a / b;<br />
19.	         printf( &#8220;x / y = %dn&#8221;, z );<br />
20.<br />
21.	         c = 100 % 3;<br />
22.	         printf( &#8220;x % y = %dn&#8221;, z );<br />
23.	 }<br />
<br />
Though the common definition of <strong>main() function</strong> is nothing but <strong>int main()</strong>, not many compilers allow main() function to return void. The standard C allows for implementation of defined versions that doesn’t return int.<br />
<br />
The output of the above program is:<br />
<br />
x + y = 103<br />
x &#8211; y = 97<br />
x * y = 300<br />
x / y = 33<br />
x % y = 1</p>
]]></content:encoded>
			<wfw:commentRss>http://www.c-cplusplus.com/operators-in-c-programming/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Building a Career as C/C++ Programmer</title>
		<link>http://www.c-cplusplus.com/building-a-career-as-cc-programmer</link>
		<comments>http://www.c-cplusplus.com/building-a-career-as-cc-programmer#comments</comments>
		<pubDate>Fri, 25 Nov 2011 09:31:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[C Programming]]></category>

		<guid isPermaLink="false">http://www.c-cplusplus.com/?p=374</guid>
		<description><![CDATA[C/C++ Programming can be really rewarding if you succeed to find the right place to be, and become a C/C++ programmer/developer for a reputed firm. But, if you get stuck at the wrong place, you’ll simply be given the C++ developer label, and in reality you’ll be forced to do things that have simply got [...]]]></description>
			<content:encoded><![CDATA[<p><strong>C/C++ Programming</strong> can be really rewarding if you succeed to find the right place to be, and become a C/C++ programmer/developer for a reputed firm. But, if you get stuck at the wrong place, you’ll simply be given the C++ developer label, and in reality you’ll be forced to do things that have simply got nothing to do with your job profile.<br />
<a href="http://www.c-cplusplus.com/wp-content/uploads/2011/11/Building-a-Career-as-C++-Programmer.jpg"><img src="http://www.c-cplusplus.com/wp-content/uploads/2011/11/Building-a-Career-as-C++-Programmer.jpg" alt="Building a Career as C++ Programmer" title="Building a Career as C++ Programmer" width="465" height="100" class="alignnone size-full wp-image-375" /></a><br />
The worst part is that after couple of years, nobody will accept you as a C++ developer anymore, because you won’t have the right track record to back the programming abilities that you claim to have (even if you really do!).<br />
<br />
<strong>Starting Problems!</strong><br />
<br />
Another big reason why not too many people really pursue a career as C/C++ developer is that it’s not too easy to get an entry into a corporate with this profile unless you’ve exceptional coding skills…  In my initial days, I had tried to get into a hardcore C++ development project for Microsoft, but then I soon realized that I wasn’t that great at network programming and stuff (though I wasn’t bad at coding after all!), and I changed my career path towards Oracle apps. And, I guess that was the right thing to do, because if you get stuck with the wrong job profile, it could mean life-long trouble.<br />
<br />
So, better find the right place for yourself, and make sure that you choose a suitable career path; if you’ve got 100% confidence in your C programming skills, then go for it, otherwise building a career as a C++ programmer may not be a great idea in the long run for those who don’t have very strong coding skills.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.c-cplusplus.com/building-a-career-as-cc-programmer/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adobe Drops Mobile Flash; Concentrates on HTML5</title>
		<link>http://www.c-cplusplus.com/adobe-drops-mobile-flash-concentrates-on-html5</link>
		<comments>http://www.c-cplusplus.com/adobe-drops-mobile-flash-concentrates-on-html5#comments</comments>
		<pubDate>Fri, 18 Nov 2011 14:59:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web Technology]]></category>

		<guid isPermaLink="false">http://www.c-cplusplus.com/?p=362</guid>
		<description><![CDATA[Adobe recently announced that it is going to discontinue Flash for the mobile browser. Danny Winokur of Adobe went on to confirm the news to ZDNet. One of the Adobe’s conversations blogs read &#8211; Flash to Focus on PC Browsing and Mobile Apps; Adobe to More Aggressively Contribute to HTML5. The announcement, however, does not [...]]]></description>
			<content:encoded><![CDATA[<p>Adobe recently announced that it is going to discontinue Flash for the mobile browser. Danny Winokur of Adobe went on to confirm the news to ZDNet.<br />
<a href="http://www.c-cplusplus.com/wp-content/uploads/2011/11/adobe-drops-mobile-flash.jpg"><img src="http://www.c-cplusplus.com/wp-content/uploads/2011/11/adobe-drops-mobile-flash.jpg" alt="adobe drops mobile flash" title="adobe-drops-mobile-flash" width="510" height="225" class="alignnone size-full wp-image-365" /></a><br />
One of the Adobe’s conversations blogs read &#8211; </p>
<blockquote><p>Flash to Focus on PC Browsing and Mobile Apps; Adobe to More Aggressively Contribute to HTML5.</p></blockquote>
<p>
The announcement, however, does not say anything about the unsatisfactory performance of Flash on different mobile browsers. It instead stated that HTML5 is increasingly becoming more and more capable of doing what Flash was capable of. The latter statement is very true, but the fact also remains that Flash enabled phones have showed degraded performance after the different plug-ins installations.<br />
<br />
 Adobe will be anyway continue working on their cross compiler that helps <a href="http://www.om-nanya.com">Flash developers</a> to make native applications that run on different <a href="http://www.myidevices.org">iOS devices</a>. So, it finally proves that Steve Jobs made the right decision of not including Adobe Flash in Apple devices. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.c-cplusplus.com/adobe-drops-mobile-flash-concentrates-on-html5/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What is PMP Certification?</title>
		<link>http://www.c-cplusplus.com/what-is-pmp-certification</link>
		<comments>http://www.c-cplusplus.com/what-is-pmp-certification#comments</comments>
		<pubDate>Thu, 03 Nov 2011 18:59:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PMP Certification]]></category>
		<category><![CDATA[what is PMP Certification]]></category>

		<guid isPermaLink="false">http://www.c-cplusplus.com/?p=357</guid>
		<description><![CDATA[Project Management Professional, commonly known as PMP, is a certification given to those who successfully pass an exam conducted by Project Management Institute (PMI). Who Offers PMP Certification? Professional development program is offered by PMI, which is designed based on Project Management Body of Knowledge Guide (PMBOK Guide). The guide contains many proven practices related [...]]]></description>
			<content:encoded><![CDATA[<p>Project Management Professional, commonly known as PMP, is a certification given to those who successfully pass an exam conducted by Project Management Institute (PMI).<br />
<br />
<strong>Who Offers PMP Certification?</strong><br />
<br />
Professional development program is offered by PMI, which is designed based on Project Management Body of Knowledge Guide (PMBOK Guide). The guide contains many proven practices related to project management, constantly evolving innovative techniques, and gain in adopting the techniques.<br />
<a href="http://www.c-cplusplus.com/wp-content/uploads/2011/11/Value-of-PMP-certification.jpeg"><img src="http://www.c-cplusplus.com/wp-content/uploads/2011/11/Value-of-PMP-certification.jpeg" alt="Value of PMP certification" title="Value-of-PMP-certification" width="378" height="239" class="alignnone size-full wp-image-367" /></a><br />
<strong>Why Is It So Important?</strong><br />
<br />
In the past, there was no <a href="http://www.c-cplusplus.com/what-is-pmp-certification">PMP certification</a>. Still, professionals had to manage their projects and work with skills covered by PMP. But, they had no official benchmark to prove their expertise. There came about a necessity of monitoring industry standards. In late 1990’s, the first PMP certification tests emerged focusing on technological fields. The practice had expanded to cover various industries in order to acknowledge the individual’s project management skills.<br />
<br />
<strong>Why Do You Need The PMP Certification?</strong><br />
<br />
You may have an extensive experience in managing projects. While hiring, employers will review work history to make a decision to hire you. The official PMP certification would add more value, and it can help you move one step ahead in your career. <a href="http://www.c-cplusplus.com/">Obtaining PMP certification</a> is nothing but proving that you are an expert project manager.  It also indicates that you are very serious about the profession and willing to invest time as well as effort to get certifications that are necessary to do the job well. It also saves the prospective employer’s time in researching validity of your work history. Once the PMP certification is obtained, then there is no doubt that you have met industry standards for project management skills.<br />
<br />
<strong>How Can You Obtain the PMP Certification?</strong><br />
<br />
It requires a significant investment in your profession. The candidate must have a minimum of three years of experience in the profession of project management. The candidate is requested to submit specific examples while submitting application.<br />
<br />
After reviewing the application, a PMP review board will approve the candidate’s work history. The approved candidate must take up the exam offered by PMI. The examination will be available throughout the world and majority will be from USA. Candidates from Australia, France, UK, and China can take up the exam in their home countries. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.c-cplusplus.com/what-is-pmp-certification/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cool C Programs: Sorting Dates in DD MM YYYY Format</title>
		<link>http://www.c-cplusplus.com/complex-c-programs-sorting-dates-in-dd-mm-yyyy-format</link>
		<comments>http://www.c-cplusplus.com/complex-c-programs-sorting-dates-in-dd-mm-yyyy-format#comments</comments>
		<pubDate>Wed, 14 Sep 2011 22:43:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Cool C Programs]]></category>

		<guid isPermaLink="false">http://www.c-cplusplus.com/?p=334</guid>
		<description><![CDATA[Here&#8217;s one of the cool C Programs that you won&#8217;t find on most websites&#8230; It&#8217;s a C Program to take any five dates in dd\mm\yyy format, and arrange them in ascending order. Steps to Develop the Program 1. Dates are entered as strings. 2. Convert the dates into integer values. 3. Check for validation of [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s one of the cool C Programs that you won&#8217;t find on most websites&#8230; It&#8217;s a C Program to take any five dates in dd\mm\yyy format, and arrange them in ascending order.</p>
<p><a href="http://www.c-cplusplus.com/wp-content/uploads/2011/09/advanced-c-programs.jpg"><img src="http://www.c-cplusplus.com/wp-content/uploads/2011/09/advanced-c-programs.jpg" alt="advanced c/c++ programs" title="advanced c programs" width="250" height="250" class="alignright size-full wp-image-369" /></a><strong>Steps to Develop the Program</strong></p>
<p>1. Dates are entered as strings.<br />
2. Convert the dates into integer values.<br />
3. Check for validation of dates.<br />
4. Sort the dates with respect to their integer values.<br />
5. Display the sorted dates.</p>
<p>To increase the range of dates, we have stored it in 4 bytes using a long integer variable (Under DOS dates are stored in 2 bytes).</p>
<p>So to store the day the lower 5 bytes are used. Now to store a month in next 4 bytes we need to multiply the month by 32.</p>
<p>Similarly, to store the year it is multiplied by 512. This is done because we are required to store the entire date in one single entity, which is later used to sort the dates.</p>
<p>/* Sorting of dates using bubble sort. */</p>
<p>#include  &lt; stdio.h &gt;<br />
#include  &lt; conio.h &gt;<br />
#include  &lt; stdlib.h &gt;<br />
#include  &lt; string.h &gt;</p>
<p>int d, m ;<br />
long int y ;</p>
<p>void main( )<br />
{<br />
char dates[5][12], temp[12] ;<br />
long int arr[5], t ;<br />
int i, j, valid ;</p>
<p>int isvalid( ) ;<br />
long int getnum ( char * ) ;</p>
<p>clrscr( ) ;</p>
<p>printf ( &#8220;Enter any five dates (dd\\mm\\yyyy) :-\n&#8221; ) ;<br />
for ( i = 0 ; i  &lt; = 4 ; i++ )<br />
{<br />
printf(&#8220;%d) &#8220;,i + 1 ) ;<br />
scanf ( &#8220;%s&#8221;, dates[i] ) ;</p>
<p>/* Converts date in string to equivalent integer values. */<br />
arr[i] = getnum ( dates[i] ) ;</p>
<p>/* Checks for valid date. */<br />
valid = isvalid( ) ;</p>
<p>if ( !valid )<br />
{<br />
printf ( &#8220;This date does not exists. &#8221; ) ;<br />
printf ( &#8220;Enter any other date.\n&#8221; ) ;<br />
i&#8211; ;<br />
}<br />
}</p>
<p>/* Sorting of dates using Bubble sort method. */<br />
for ( i = 0 ; i  &lt; = 3 ; i++ )<br />
{<br />
for ( j = 0 ; j  &lt; = 3 &#8211; i ; j++ )<br />
{<br />
if ( arr[j]  &gt;  arr[j + 1] )<br />
{<br />
t = arr[j] ;<br />
arr[j] = arr[j + 1] ;<br />
arr[j + 1] = t ;</p>
<p>strcpy ( temp, dates[j] ) ;<br />
strcpy ( dates[j], dates[j + 1]) ;<br />
strcpy ( dates[j + 1], temp ) ;<br />
}<br />
}<br />
}</p>
<p>printf ( &#8220;Dates in sorted order are :- \n&#8221; ) ;<br />
for ( i = 0 ; i  &lt; = 4 ; i++ )<br />
printf ( &#8220;%s\n&#8221;, dates[i] ) ;</p>
<p>getch( ) ;<br />
}</p>
<p>/* checks valid date */<br />
int isvalid ( )<br />
{<br />
int isleap ( long int ) ;</p>
<p>if ( y  &lt; = 0 || m  &lt; = 0 || d  &lt; = 0 || m  &gt;  12 || y  &gt;  16384 ||<br />
( m == 2 &amp;&amp; !isleap ( y ) &amp;&amp; d  &gt;  28 ) ||<br />
( m == 2 &amp;&amp; isleap ( y ) &amp;&amp; d  &gt;  29 ) ||<br />
( ( m == 1 || m == 3 || m == 5 || m == 7 || m == 8 || m == 10<br />
|| m == 12 ) &amp;&amp; d  &gt;  31 ) || ( ( m == 4 || m == 6 || m == 9 ||<br />
m == 11 ) &amp;&amp; d  &gt;  30 ) )<br />
return 0 ;<br />
else<br />
return 1 ;<br />
}</p>
<p>/* checks whether the given year is leap or not */<br />
int isleap ( long int y )<br />
{<br />
return ( y % 4 == 0 ) ^ ( y % 100 == 0 ) ^ ( y % 400 == 0 ) ;<br />
}</p>
<p>/* converts dates in string into equivalent integer values */<br />
long int getnum ( char *date )<br />
{<br />
char *p, str[15] ;<br />
long int num = 0 ;</p>
<p>strcpy ( str, date ) ;</p>
<p>d = m = y = 0 ;<br />
p = strtok ( str, &#8220;\\&#8221; ) ;<br />
if ( p != NULL )<br />
d = num = atoi ( p )  ;</p>
<p>p = strtok(NULL, &#8220;\\&#8221;);<br />
if ( p != NULL )<br />
m = atoi ( p ) ;<br />
num += m * 32 ;</p>
<p>p = strtok(NULL, &#8220;\\&#8221;);<br />
if ( p != NULL )<br />
y = atol ( p ) ;<br />
num += y * 512L ;</p>
<p>return num ;<br />
}</p>
<p>So, wasn&#8217;t it one of the <a href="http://www.c-cplusplus.com">cool c programs</a> that we have given out so far?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.c-cplusplus.com/complex-c-programs-sorting-dates-in-dd-mm-yyyy-format/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Heap Sort in C: Basics &amp; Code Snippet</title>
		<link>http://www.c-cplusplus.com/heap-sort</link>
		<comments>http://www.c-cplusplus.com/heap-sort#comments</comments>
		<pubDate>Thu, 25 Aug 2011 17:21:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Sample C Programs for Beginners]]></category>

		<guid isPermaLink="false">http://www.c-cplusplus.com/?p=324</guid>
		<description><![CDATA[Few of the sorting techniques like the bubble sort, selection or the insertion sort are good enough for sorting small number of element, while heap sort is used to large number of elements, in a faster way. It&#8217;s simple as well, but all it consumes is the additional memory. Before we get into heap sort [...]]]></description>
			<content:encoded><![CDATA[<p>Few of the sorting techniques like the bubble sort, selection or the insertion sort are good enough for sorting small number of element, while <a href="http://www.c-cplusplus.com/heap-sort">heap sort</a> is used to large number of elements, in a faster way. It&#8217;s simple as well, but all it consumes is the additional memory.<br />
<br />
Before we get into heap sort technique, let us learn something about the heap data structure, which is used in heap sort. Top element that is present in the heap indicates the next in the line as in the order either it may be highest or the lowest.<br />
<a href="http://www.c-cplusplus.com/wp-content/uploads/2011/08/heap-sort.gif"><img src="http://www.c-cplusplus.com/wp-content/uploads/2011/08/heap-sort.gif" alt="heap sort in c" title="heap-sort" width="396" height="324" class="alignnone size-full wp-image-371" /></a><br />
Firstly, we will have to create a heap and then go on adding elements to the heap and once you want to delete it then you can easily remove from the heap and in a sorted order as such.<br />
<br />
There are two things here one has to worry about &#8211;<br />
<br />
a. that is the time taken to create the heap, and<br />
b. the time taken to add and remove the element from the heap.</p>
<p>Well, this is quite faster when compared to any of the other sorting techniques.<br />
<br />
One of the major disadvantages associated with this technique is that it&#8217;s not stable for equal elements, as in it does not preserve the original order. F<br />
<br />
or instance if we consider having a list of messages in your inbox then, then you would want the sort by both time and date as well as in an alphabetical order. Then in such cases, you can first sort it as per the date and time and then sort as per the alphabetical order.<br />
<br />
Let us illustrate the above scenario with an example:<br />
<br />
From:  a@qwerty.com       sent: 1/1/2011<br />
From:  b@qwerty.com       sent:  1/1/2011<br />
From:  c@qwerty.com        sent: 2/9/2009<br />
After sorting using heap sort<br />
From:  c@qwerty.com        sent: 2/9/2009<br />
From:  b@qwerty.com       sent:  1/1/2011<br />
From:  a@qwerty.com       sent: 1/1/2011<br />
<br />
As we can see that “b” is ahead of “a” which does not happen in any other sorting techniques as such which indicates that the sort is unstable. A stable sort should look like:<br />
<br />
From:  c@qwerty.com        sent: 2/9/2009<br />
From:  a@qwerty.com       sent: 1/1/2011<br />
From:  b@qwerty.com       sent:  1/1/2011</p>
<p>
<strong>Code Snippet to Implement Heap Sort in C Programming Language</strong><br />
<br />
void HSort(int num[], int size)<br />
{<br />
  int j, temp;<br />
 for (j = (size / 2); j >= 0; j&#8211;)<br />
    shift(num, j, size &#8211; 1);<br />
 for (j = size-1; j >= 1; j&#8211;)<br />
  {<br />
    temp = num[0];<br />
    num[0] = num[i];<br />
    num[i] = temp;<br />
    shift(num, 0, i-1);<br />
  }<br />
}<br />
void shift(int num [], int head, int tail)<br />
{<br />
  int ok, max, temp;<br />
  ok = 0;<br />
  while ((head*2 <= tail) &#038;&#038; (!ok))<br />
  {<br />
    if (head*2 == tail)<br />
      max = head * 2;<br />
    else if (num [head * 2] > num [head * 2 + 1])<br />
      max= head * 2;<br />
    else<br />
      max = head * 2 + 1;</p>
<p>    if (num [head] < num[max])<br />
    {<br />
      temp = num[head];<br />
      num[head] = num [max];<br />
      num[max] = temp;<br />
      head = max;<br />
    }<br />
    else<br />
      ok = 1;<br />
  }<br />
}<br />
<br />
So, that was a simple <a href="http://www.c-cplusplus.com/heap-sort">illustration of heap sort in c</a> &#8211; stay tuned for more useful code snippets!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.c-cplusplus.com/heap-sort/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

