title: For loop only executes once, raising a number to another number
body: <p>New to programming/coding, and couldn't get why my code doesn't work.</p>
  <p>It's supposed to show you the result of raising a number to another number. But it only ends up looping once.</p>
  <p>Example of error:</p>
  <pre>
  Input an integer: 3
  
  Raise integer to what number: 4
  
  3 raised to 4 is 9
  </pre>
  <p>My code:</p>
  <pre class="lang-cpp prettyprint-override"><code>#include &lt;stdio.h&gt;
  
  int raiseToPow(int nNum1, int *nResult) {
    *nResult = nNum1 * nNum1;
  }
  
  int main() {
    int nNum1, nNum2, nResult, i;
  
    printf(&quot;Input an integer: &quot;);
    scanf(&quot;%d&quot;, &amp;nNum1);
    printf(&quot;\n&quot;);
    printf(&quot;Raise integer to what number: &quot;);
    scanf(&quot;%d&quot;, &amp;nNum2);
    printf(&quot;\n&quot;);
      
    for (i = 0; i &lt; nNum2; i++) {
      raiseToPow(nNum1, &amp;nResult);
    }
    printf(&quot;%d raised to %d is %d&quot;, nNum1, nNum2, nResult);
  }
  </code></pre>