Clicky

Fortran Wiki
allocate_coin_toss

Skip the Navigation Links | Home Page | All Pages | Recently Revised | Authors | Feeds | Export |

Originally posted to comp.lang.fortran.

program allocate_coin_toss
 implicit none
 real, dimension(:,:), allocatable :: a
 real :: u
 call random_number(u)
 if (u < 0.5) then
 allocate(a(5,8))
 else
 allocate(a(7,4))
 end if
 print *, shape(a)
 deallocate(a)
end program allocate_coin_toss

category: code

Revised on May 1, 2009 21:28:03 by Jason Blevins (71.70.142.190) (463 characters / 0.0 pages)
Edit | Back in time (1 revision) | See changes | History | Views: Print | TeX | Source | Linked from: Code, Dynamic memory allocation

AltStyle によって変換されたページ (->オリジナル) /