Fortran pass by reference pass by value homework

Viewed 4757

I had a question on a hw that I got wrong and was wonder if someone could explain it. Don't worry class is over just wanted to know why it's wrong. I asked a few other student and they had the same answer I had as well. I also look on line but all the examples I found are swap functions the X=1 is confusing me.

    SUBROUTINE TEST(X,Y,Z)
    X=1
    Z=X+Y
    RETURN 
    END


    N=2
    CALL TEST ( N,N,M)

   WHAT WILL M BE IF PASSED BY REFERENCE?
   WHAT WILL M BE IF PASSED BY VALUE-RESULT?

I got 3 for the first and 4 for the second question.

1 Answers
Related