Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Spanky Deluxe

macrumors 603
Original poster
Mar 17, 2005
5,293
1,839
London, UK
Hi guys,

I'd like to split up my fortran program into several functions but I need to be able to pass arrays to these functions.

Right now I've got this:

Code:
PROGRAM test1
IMPLICIT NONE
	...
	real x(maxpoints), y(maxpoints), z(maxpoints)
	...
END PROGRAM test1

FUNCTION distance(x, y, z)
	write(*,*) 'Hello'
END FUNCTION distance

I realise this isn't right but I don't know what I'm supposed to be doing with functions - I was told that Fortran deals with memory and arrays very differently to C which I'm used to.

x, y and z are arrays of a certain length which need to be acted upon in the function.

Can anyone help?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.