title: How to call a function with "int" argument in C?
body: <p>I have been writing code with C and I needed to define a function with arguments of the type <code>int</code>. Basically, I want to make a check on a number, however, this number might be 13, 15, or 16 digits. I've divided the number into an array so I can have every digit alone and I've created a <code>for</code> loop in order to do some processing on. I just want the maximum number of the <code>for</code> loop to be a variable.</p>
  
  <p>What I had tried is writing a <code>for</code> loop but with the maximum number as a variable <code>R</code> not a number. The problem is that the program doesn't compile unless I initialize the variable <code>R</code> value which is to be taken when calling the function in the main function. I've attached the code to you and I will be glad if anyone can help me with that. Thanks.</p>
  
  <pre class="lang-c prettyprint-override"><code>int CHECK(int R);                        // Function Prototype
  int main() {
      ...
      ...
      var = CHECK(15);               // Function called
      ...
      ...
  </code></pre>
  
  <pre class="lang-c prettyprint-override"><code>int CHECK(int R);                 // Function definition
  {
      int R;    
      for  (int z = 1; z &lt;= R; z += 2) {
          if (array[z] &lt;= 4)
          ...
  </code></pre>
  
  <p>This error appears when I compile the file:</p>
  
  <pre class="lang-none prettyprint-override"><code>credit.c:56:9: note: initialize the variable 'R' to silence this warning
  int R;    
      ^
       = 0
  1 error generated.
  &lt;builtin&gt;: recipe for target 'credit' failed
  make: *** [credit] Error 1
  </code></pre>
  
  <p>If I have to define the <code>R</code> variable than his value will not be changed and I cannot <code>R</code> as an operation result. What shall I do?</p>