replica nfl jerseysreplica nfl jerseyssoccer jerseyreplica nfl jerseys forums.silverfrost.com :: View topic - Array assignment query
forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Array assignment query

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
sparge



Joined: 11 Apr 2005
Posts: 371

PostPosted: Mon Mar 08, 2010 4:25 pm    Post subject: Array assignment query Reply with quote

I was under the impression that "broadcast" assignment for arrays worked with CHARACTER type variables just like it does for numeric data types. However, in the following program (and using, admittedly, v5.40 rather than v5.50), whilst all the characters in variable astring change their values following the assignment statement, only the first character gets assigned the value char(0); the remainder (somehow) get assigned the value 0x20. Have I been under a false impression or is this behaviour indeed unexpected?

Andy

program array_setting
integer, parameter :: elements = 8
character (len = elements) astring
astring (Smile = char (0)
stop
end program array_setting
Back to top
View user's profile Send private message Send e-mail
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 8210
Location: Salford, UK

PostPosted: Mon Mar 08, 2010 7:30 pm    Post subject: Reply with quote

I get the result that I would expect.
There is only one character variable rather than an array of characters.
So only the first character is set to null.
An array of single characters gives the result that you want.
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group