- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
Is it possible to allocate an array, but have 0 as its base?
I know non-allocatable is easy with integer :: fred(0:10)
But I'm not sure how to do it with an allocatable array
Link kopiert
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
Not much different than with declarations:
allocate( fred(0:10) )
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
Arjen Markus wrote:
Not much different than with declarations:
allocate( fred(0:10) )
oh dear, I'm sure I tried that a few months ago and it didn't work. anyway works fine now thanks
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
Make sure you didn't try something like this:
real, allocatable :: fred(0:) ... allocate (fred(0:10))
The declaration of fred has to be with (:) - no lower bound. If you have a lower bound, then it can't be allocatable (could be a dummy argument.)
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
Steve Lionel (Intel) wrote:
Make sure you didn't try something like this:
real, allocatable :: fred(0:) ... allocate (fred(0:10))The declaration of fred has to be with (:) - no lower bound. If you have a lower bound, then it can't be allocatable (could be a dummy argument.)
I may well have done that. Thanks for the heads up.
- RSS-Feed abonnieren
- Thema als neu kennzeichnen
- Thema als gelesen kennzeichnen
- Diesen Thema für aktuellen Benutzer floaten
- Lesezeichen
- Abonnieren
- Drucker-Anzeigeseite