If your data is in a file, it is not necessary to enter the elements of an array for the program. There are limits of memory for holding arrays there, but for files there aren't.
2006-07-23 21:37:29
·
answer #1
·
answered by iyiogrenci 6
·
0⤊
0⤋
An Array is a collection of data that is only available for the duration of the Arrays scope.
If you don't know about programming then this means that once the program ends the Array is gone.
A file is a more permanent form of storage.
As a collection of data an Array has a limit to its capacity. This is usually because a program should not be created to be overly large.
This means that if you have designed a program with a large Array then this design should be reconsidered to process the data from a file.
A Files type indicates what sort of access is avail, Sequential, Keyed or Random.
An Array is accessed by a subscript.
This subscript can be processed sequentially in a loop or randomly.
2006-07-23 23:00:23
·
answer #2
·
answered by AnalProgrammer 7
·
0⤊
0⤋
They are dynamically allocated. This is one of their biggest advantages over ordinary C arrays. Dynamically allocating arrays in C normally requires the user to either be very clever in the method of allocation, or to do a multiplication at every element access (assuming a 2D array). Iarrays use double indirection to allow for an efficient and neat accessing scheme. This method also allows for interesting mappings of the iarray, such as taking real subarrays, or mapping an array onto a torus efficiently.
They know their own size. This removes the necessity for passing in dimension lengths to functions which take arrays as arguments. iarray_dim_length allows you to query an array for one of it's dimension lengths.
They can do run time bounds checking. If you compile with ``-DDEBUG'' all element accesses will be bounds and type checked. This is somewhat slower than normal, but the implementation is such that without bounds checking there is no performance penalty over C arrays.
They can have named attachments. Using iarray_put_float and iarray_get_float, named floating point values can be attached to and retrieved from an iarray. There are corresponding functions for attaching ints and strings, and a pair of generic functions for handling other data types. This is very useful when writing iarrays to disk or to a connection, as attachments are also transferred. Attachments are often thought of as ``keyword-value'' pairs in the ``header of a data file.
They can be written to a disk or connection very easily, and are written in the Karma data format, which ensures portability across a wide range of platforms, and ease of use with Karma modules.
2006-07-23 23:25:16
·
answer #3
·
answered by Anonymous
·
0⤊
0⤋
Ahh... easier to understand for new programmers? ;-)
1. Max. size must be known in advance
--> True of static arrays, but not dynamic arrays
--> Not true of vectors
2. Expensive to add an element in the middle of an array
--> Every subsequent element must be shifted out of the way.
--> True of both static and dynamic arrays
3. An array can be accessed in a random way, as is done with large hash tables, and in this case this is not a benefit. * For further reading check out "Javascript Associative Arrays considered harmful" article available in the Net.
2006-07-23 22:26:38
·
answer #4
·
answered by dranagar 5
·
0⤊
0⤋
Arrays are much faster than file storage. But need to compromise over size.
2006-07-23 21:48:39
·
answer #5
·
answered by agsrivaths 2
·
0⤊
0⤋
Files:
Permanent storage
Unlimited size (depends on File System)
Portable
2006-07-23 21:54:42
·
answer #6
·
answered by Anonymous
·
0⤊
0⤋
files offer capacity and persistance unattainable with arrays.
2006-07-23 21:33:24
·
answer #7
·
answered by Anonymous
·
0⤊
0⤋