I have trouble understanding how Fortran knows the inputs and outputs of a subroutine. I am studying a code written in Fortran, but I do not have a compiler, so I cannot check how it works. Here is my problem; for example, I have a subroutine, subroutine test(x, y, z, a, b, c) The variables x, y, and z have values in the main program and are needed in the subroutine, while a, b, and c are the supposed outputs. What troubles me are: 1. Should all six variables be defined in the main program and in the subroutine (defined to be real, integer, complex, etc.)? 2. Is it alright if I define (defined to be real, integer, complex, etc.) a variable in the subroutine and not in the main program? How about vice versa? What are the consequences of this action? 3. If x, y, and z somehow receive a new value in the subroutine, will the previous values be replaced in the main program (x, y, and z become part of the output)? 4. If there's a variable named d in the subroutine, will I be able to call it in the main program even though it's not part of the output? Thank you in advance.