Howtogetpriorly-unknownarrayastheoutputofafunctioninFortran在Python中:123456defselect(x): y=[] foreinx: ife!=0: y.append(e) returny的作用是:123x=[1,0,2,0,0,3]select(x)[1,2,3]要翻译成Fortran:1234567891011functionselect(x,n)result(y) implicitnone integer::x(n),n,i,j,y(?) j=0 doi=1,n if(x(i)/=0
Howtogetpriorly-unknownarrayastheoutputofafunctioninFortran在Python中:123456defselect(x): y=[] foreinx: ife!=0: y.append(e) returny的作用是:123x=[1,0,2,0,0,3]select(x)[1,2,3]要翻译成Fortran:1234567891011functionselect(x,n)result(y) implicitnone integer::x(n),n,i,j,y(?) j=0 doi=1,n if(x(i)/=0