title: Does using function in programs speed up execution?
body: <p>I just wanted to know If using function in the programs speeds up execution time? </p>
  
  <p>Say, I have simple binary search Program </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int main()
  {
     int c, first, last, middle, n, search, array[100];
     scanf("%d",&amp;n);
     for ( c = 0 ; c &lt; n ; c++ )
     scanf("%d",&amp;array[c]);
     scanf("%d",&amp;search);
  
     first = 0;
     last = n - 1;
     middle = (first+last)/2;
  
     while( first &lt;= last )
     {
        if ( array[middle] &lt; search )
           first = middle + 1;    
        else if ( array[middle] == search ) 
        {
           printf("%d found at location %d.\n", search, middle+1);
           break;
        }
        else
           last = middle - 1;
  
        middle = (first + last)/2;
     }
     if ( first &gt; last )
        printf("Not found! %d is not present in the list.\n", search);
  
     return 0;   
  }
  </code></pre>
  
  <p>And Same Program using function. </p>
  
  <p>I have just added the function</p>
  
  <pre><code>int binarysearch(int *array,int m,int n)
  {
  
      int l,u,mid;
  l=0,u=n-1;
      while(l&lt;=u)
          {
           mid=(l+u)/2;
           if(m==a[mid])
              {
               c=1;
               break;
           }
           else if(m&lt;a[mid])
              {
               u=mid-1;
           }
           else
               l=mid+1;
      }
      return mid;
  }
  </code></pre>
  
  <p>Code is just for understanding purpose!</p>
  
  <p>Now Which will run faster? Program using Function or Iterative Programs? I'm talking in general not about any specific program. </p>