answersLogoWhite

0

The most obvious reason is to store a string within a data structure. After all, a string is a null-terminated array of type char. And if we can store a simple character array in a data structure, there's nothing to stop us storing any type of array in a data structure.

As a more practical example, consider a structure that stores a name and an address. An address might be represented by 3, 4 or 5 string fields, but we could just as easily use an array of strings instead and thus cater for any number of lines (a null terminator can be used to mark the end of the array or we can store the line count in the structure itself).

As well as variable-length arrays we can also store fixed-length arrays in a structure. For instance, suppose we wished to create a record of a particular Sudoku puzzle with fields denoting the publisher, the date of publication, the level of difficulty and so on. The puzzle itself can be represented as a 9x9 array of integers within the structure itself.

User Avatar

Wiki User

8y ago

Still curious? Ask our experts.

Chat with our AI personalities

MaxineMaxine
I respect you enough to keep it real.
Chat with Maxine
LaoLao
The path is yours to walk; I am only here to hold up a mirror.
Chat with Lao
ProfessorProfessor
I will give you the most educated answer.
Chat with Professor
More answers

Data structures could be used to implement an efficient database. Linked lists for example will optimize insertion and deletion for ordered lists.

User Avatar

Wiki User

16y ago
User Avatar

Add your answer:

Earn +20 pts
Q: What are the applications of array in data structure?
Write your answer...
Submit
Still have questions?
magnify glass
imp