Are there subroutines in C similar to the ones in Fortran?
<p>For long time I have been using Fortran and recently I decided to learn C. While I understand how functions in C work, I am having troubles finding information about how to implement something equivalent to Fortran subroutines in C. Does this concept exist at all in the C language?</p>

<p>Consider this Fortran code:</p>

<pre><code>module myMod
  implicit none
  contains

    function func(a, b)
      integer :: func
      integer, intent(IN) :: a, b
      func = a + b
    end function func

    subroutine sub(a, b, c)
      integer, intent(INOUT) :: a, b
      integer, intent(OUT) :: c
      a = a * b
      b = 3 * a
      c = a + b
    end subroutine sub

end module myMod

program example
  use myMod
  implicit none
  integer :: i, j, k

  i = 1
  j = 2

  k = func(i,j)
  print*, k

  call sub(i,j,k)
  print*, i, j, k

end program example
</code></pre>

<p>The function in the module myMod would be trivial to translate into C, but what about the subroutine? Is there a way of doing something similar?</p>

<hr>

<p>EDIT: for instance, the code below is not outputting what I expected:</p>

<pre><code>#include &lt;stdio.h&gt;

void subroutine(int num1, int num2) {
    num1 -= 1;
    num2 *= 2;
    printf("this has been executed! \n");
}

int main () {

    int a = 10;
    int b = 10;

    subroutine(a,b);
    printf( "a = %d, b = %d \n", a, b);

    return 0;
}
</code></pre>

<p>It outputs:</p>

<pre><code>this has been executed!
a = 10, b = 10 
</code></pre>

<p>Instead of the expected:</p>

<pre><code>this has been executed!
a = 9, b = 20 
</code></pre>

<p>So why aren't the variables a and b modified in that void function, like a Fortran subroutine would do?</p>