Explain how records are represented in memory using an array?
Each data item is termed as a field. A file is a collection of similar records. Each data item may be a group item composed of sub items.
Consider a record, whose structure is given below
3. First name
3. Last name
2. Phone no
To present this record in memory, linear arrays are used.
One separate linear array is used for each elementary item of record such as First name, Last name, Sex, City, Pincode, Phone no
Following figure shows representation of above record using parallel linear arrays.
The records are stored in memory using parallel linear arrays, such that for an index K of all records, First name [K], Last name [K], Sex [K], .... belong to the same record in a file. (i.e. Kth record in the file).