title: Avoid Multiple nested if statement in C
body: <p>I'm thinking to avoid the nested if statements occur in my code. </p>
  
  <pre><code>for (i = 0; i &lt; N; i++) {
    if(x &amp; y != 0) {
       if(z &amp; k ==  z) {
          if(w &amp; ( (c || u) &amp;&amp; f)) { 
              //  Do something with the checked condition
          }
        }
      }
   } 
               `
  </code></pre>
  
  <p>First The for loop and then inside multiple if statements looks ugly . Also the values x, y , z, k etc are of form edgeBag[i].edgeWeight or even larger than that in width hence it looks more ugly. </p>
  
  <p>One way i can think is to use variable to store the x, y, z etc and then use the variable inside the if statement to check the condition.</p>
  
  <pre><code> for (i = 0; i &lt; N; i++) {
   a = x;
   b = y; 
   ...
     if(a &amp; b != 0) {
         ...
            ...
             // .....
      }
    }
  </code></pre>
  
  <p>In beginning i was not very annoyed by this but once this pattern started to occur very often it's annoying. Is there any way to avoid this pattern. Or a better way to state that. Thanks.</p>