<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>'problem in while loop.' Thread RSS Feed</title>
    <link>http://www.programmersheaven.com/</link>
    <description>Contains the latest posts from the thread 'problem in while loop.' posted on the 'Beginner C/C++' forum at Programmer's Heaven.</description>
    <language>en</language>
    <copyright>Copyright 2012 Programmers Heaven</copyright>
    <pubDate>Thu, 09 Feb 2012 09:37:51 -0800</pubDate>
    <lastBuildDate>Thu, 09 Feb 2012 09:37:51 -0800</lastBuildDate>
    <generator>Argotic Syndication Framework 2007.3.0.1, http://www.codeplex.com/Argotic</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>360</ttl>
    <image>
      <url>http://www.programmersheaven.com/images/ph.gif</url>
      <title>Programmers Heaven</title>
      <link>http://www.programmersheaven.com/</link>
      <width>88</width>
      <height>31</height>
    </image>
    <item>
      <title>problem in while loop.</title>
      <link>http://www.programmersheaven.com/mb/beginnercpp/410003/410003/problem-in-while-loop/</link>
      <description>I think there's a problem in my condition inside the while loop. my linked list is supposed to traverse until the two pointers to two different linkedlists become null. but after one of the pointers becomes null, the program exits the loop. why is that? please help. thanks!&lt;br /&gt;
&lt;br /&gt;
here's my code for the while loop. &lt;br /&gt;
&lt;br /&gt;
&lt;pre class="sourcecode"&gt;
while( ptr!=NULL &amp;amp;&amp;amp; ptr2!= NULL){
	
			if(ptr3 == NULL){
			
			if( ptr -&amp;gt; exponent != ptr2 -&amp;gt; exponent ){
				if (ptr -&amp;gt; exponent &amp;gt; ptr2 -&amp;gt; exponent){
										temp -&amp;gt; exponent = ptr -&amp;gt; exponent;
					temp -&amp;gt; coeff =  ptr -&amp;gt; coeff;
					ptr = ptr -&amp;gt; next;
									}else if( ptr2 -&amp;gt; exponent &amp;gt;  ptr -&amp;gt; exponent){
															temp -&amp;gt; exponent = ptr2 -&amp;gt; exponent;
					temp -&amp;gt; coeff = ptr2 -&amp;gt; coeff;
					ptr2 = ptr2 -&amp;gt; next;
					
				}
			}else{
								temp -&amp;gt; exponent = ptr -&amp;gt; exponent;
				temp -&amp;gt; coeff = (ptr -&amp;gt; coeff) + (ptr2 -&amp;gt; coeff);
			
							
				ptr = ptr -&amp;gt; next;
				ptr2 = ptr2 -&amp;gt; next;
			}
						temp -&amp;gt; next = head3;
			head3 = temp;
		
		}else if(ptr == NULL){
			
			temp -&amp;gt; next = NULL;
			temp -&amp;gt; exponent = ptr2 -&amp;gt; exponent;
			temp -&amp;gt; coeff = ptr2 -&amp;gt; coeff;
			ptr3 -&amp;gt; next = temp;
			ptr2 = ptr2 -&amp;gt; next;
		}else if(ptr2 == NULL){
			
			temp -&amp;gt; next = NULL;
			temp -&amp;gt; exponent = ptr -&amp;gt; exponent;
			temp -&amp;gt; coeff = ptr -&amp;gt; coeff;
			ptr3 -&amp;gt; next = temp;
			ptr = ptr -&amp;gt; next;
		}else{
					if( ptr -&amp;gt; exponent != ptr2 -&amp;gt; exponent){
								if (ptr -&amp;gt; exponent &amp;gt; ptr2 -&amp;gt; exponent ){
										temp -&amp;gt; exponent = ptr -&amp;gt; exponent;
					temp -&amp;gt; coeff = ptr -&amp;gt; coeff;
					ptr = ptr -&amp;gt; next;
					
				}else if( ptr2 -&amp;gt; exponent &amp;gt;  ptr -&amp;gt; exponent ){
										temp -&amp;gt; exponent = 	ptr2 -&amp;gt; exponent;
					temp -&amp;gt; coeff = ptr2 -&amp;gt; coeff;
					ptr2 = ptr2 -&amp;gt; next;
									}
			}else{
								temp -&amp;gt; exponent =  ptr -&amp;gt; exponent;
				temp -&amp;gt; coeff = (ptr -&amp;gt; coeff) + (ptr2 -&amp;gt; coeff);
								
				ptr = ptr -&amp;gt; next;
				ptr2 = ptr2 -&amp;gt; next;
			}
						
			temp -&amp;gt; next = NULL;
			ptr3 -&amp;gt; next = temp;
		}
		
	}&lt;/pre&gt;&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/beginnercpp/410003/410003/problem-in-while-loop/</guid>
      <pubDate>Sat, 28 Nov 2009 21:01:47 -0800</pubDate>
      <category>Beginner C/C++</category>
    </item>
  </channel>
</rss>
