Path: utzoo!mnetor!uunet!husc6!mailrus!ames!pasteur!ucbvax!carleton.EDU!LLACROIX From: LLACROIX@carleton.EDU (Les LaCroix) Newsgroups: comp.os.vms Subject: re: FORTRAN vs. C Message-ID: <8804181943.AA24033@ucbvax.Berkeley.EDU> Date: 14 Apr 88 17:51:00 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 29 As long as everyone is on the topic of local variables and argument passing in Fortran vs. C, here's a little quiz. (I don't want a response, I already know the answer. At least for VMS 4.7, VAX C 2.3, and VAX Fortran 4.7.) What do these programs output: main.for: main.c: program main main() { integer i,j int i,j; do i=1,10 for (i=1; i <= 10; ++i) { call fun(%val(1),j) fun(1,&j); type *,j printf("%11d\n",j); end do } end } when linked with the C function: fun(int k, int *j) { *j = k++; } Hint: although fun() is a legal C function, it violates the VAX Procedure Calling and Condition Handling Standard. ----------- Les LaCroix SPSS Inc., 402 Washington, Northfield MN USA 55057-2027 507/663-1205 llacroix@carleton.edu - or - llacroix%carleton.edu@relay.cs.net (CSnet) (BITNET -- don't know why the other one fails)