Talk:Sorting algorithms/Shell sort: Difference between revisions

From Rosetta Code
Content added Content deleted
(Fortran question)
 
 
(2 intermediate revisions by 2 users not shown)
Line 2: Line 2:
DO i = increment+1, SIZE(a)
DO i = increment+1, SIZE(a)
means? Could that be translated into C-style code? --[[User:Mwn3d|Mwn3d]] 08:34, 20 May 2008 (MDT)
means? Could that be translated into C-style code? --[[User:Mwn3d|Mwn3d]] 08:34, 20 May 2008 (MDT)

Try
for (i=increment; i<=(Number of elements in array)-1; i++)
Note by default fortran arrays are 1 based while C arrays are 0 based
:That did it. Thanks. --[[User:Mwn3d|Mwn3d]] 11:32, 20 May 2008 (MDT)

Latest revision as of 14:52, 6 February 2010

I'm trying to translate the fortran code and I can't figure out what the line:

DO i = increment+1, SIZE(a)

means? Could that be translated into C-style code? --Mwn3d 08:34, 20 May 2008 (MDT)

Try

for (i=increment; i<=(Number of elements in array)-1; i++)

Note by default fortran arrays are 1 based while C arrays are 0 based

That did it. Thanks. --Mwn3d 11:32, 20 May 2008 (MDT)