linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* C/Fortran mixing - Passing arrays
@ 2003-05-18 16:37 Elias Athanasopoulos
  2003-05-18 19:29 ` Glynn Clements
  0 siblings, 1 reply; 2+ messages in thread
From: Elias Athanasopoulos @ 2003-05-18 16:37 UTC (permalink / raw)
  To: linux-c-programming

Hello!

I have a fortran subroutine with the prototype:

subroutine evolvePDF (x, Q, f)
...
real*8 f(-6,6)

which I want to call from C. My problem is that C, IIRC, doesn't support 
negative indexes. Is there a workaround?

Regards,
Elias

-- 
University of Athens			I bet the human brain 
Physics Department				is a kludge --Marvin Minsky 

	

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: C/Fortran mixing - Passing arrays
  2003-05-18 16:37 C/Fortran mixing - Passing arrays Elias Athanasopoulos
@ 2003-05-18 19:29 ` Glynn Clements
  0 siblings, 0 replies; 2+ messages in thread
From: Glynn Clements @ 2003-05-18 19:29 UTC (permalink / raw)
  To: Elias Athanasopoulos; +Cc: linux-c-programming


Elias Athanasopoulos wrote:

> I have a fortran subroutine with the prototype:
> 
> subroutine evolvePDF (x, Q, f)
> ...
> real*8 f(-6,6)
> 
> which I want to call from C. My problem is that C, IIRC, doesn't support 
> negative indexes.

C supports negative indices in the sense that the following works:

	int f[8] = {1,2,3,4,5,6,7,8};
	int *p = f + 4;
	int i;
	
	for (i = -4; i < 4; i++)
		printf("%d\n", p[i]);

-- 
Glynn Clements <glynn.clements@virgin.net>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-05-18 19:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-05-18 16:37 C/Fortran mixing - Passing arrays Elias Athanasopoulos
2003-05-18 19:29 ` Glynn Clements

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).