Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

FORTRAN has the convention that all parameter passing is by reference. Nevertheless, as described in the chapter, it is possible to call subroutines with nonvariable

FORTRAN has the convention that all parameter passing is by reference. Nevertheless, as described in the chapter, it is possible to call subroutines with nonvariable expressions as arguments, as in CALL P(X,X+Y,2).

(a) Explain how one can pass a variable X by value in FORTRAN.

(b) Suppose that subroutine P is declared as follows:

SUBROUTINE P(A)

INTEGER A PRINT *, A

A = A + 1 RETURN END

and is called from the main program as follows:

CALL P(1)

In some FORTRAN systems, this will cause a runtime error. In others, no runtime error occurs, but if the subroutine is called again with 1 as its argument, it may print the value 2. Explain how both behaviors might occur.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Power Of Numbers In Health Care A Students Journey In Data Analysis

Authors: Kaiden

1st Edition

8119747887, 978-8119747887

More Books

Students also viewed these Databases questions

Question

Explain the strength of acid and alkali solutions with examples

Answered: 1 week ago

Question

Introduce and define metals and nonmetals and explain with examples

Answered: 1 week ago