ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 6th, 2005, 01:08 PM
Alas's Avatar
Alas Alas is offline
Wickedwd.com
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Location: wickedwd.com
Posts: 187 Alas Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 17 h 32 m 22 sec
Reputation Power: 0
Whats difference between structure and array?

What's difference between structure and array?

I'm trying to do a who's online list on an online community, but i'm a bit confused. Should i create a structure of those that went through the login form and then loop it to see if the guys in the list? do i do this with structure or array and what's the difference?

Reply With Quote
  #2  
Old May 6th, 2005, 01:44 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,661 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 14 h 23 m 22 sec
Reputation Power: 53
The crucial difference is that structure elements are referenced by key name, where arrays are referenced numerically. Also, in a structure the order is essentially random, while an array enforces the order of the elements.

So, if you have a set of data that you want to reference by key and you are not concerned with the order of the elements (ie user.firstName, user.lastName) use a structure.

If you have a set of data where you don't know how many elements will be in it, or where the order of the elements is important, use an array (onlineUsers[1], onlineUsers[2], etc.)

The "who's online" data set that you describe should be stored an array because a) the number of elements will be variable, and b) you don't want to reference them by a key.
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian.
How to Post a Question in the Forums

Reply With Quote
  #3  
Old May 6th, 2005, 03:14 PM
Alas's Avatar
Alas Alas is offline
Wickedwd.com
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Location: wickedwd.com
Posts: 187 Alas Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 17 h 32 m 22 sec
Reputation Power: 0
Thumbs up

thx got it
what a pain it was.

Last edited by Alas : May 7th, 2005 at 02:46 AM. Reason: thx

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Whats difference between structure and array?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway