8 AnswersNew Answer
Main reason is efficiency. By using a data structure, we influence the ability of a computer to store, process, and retrieve data from any location in memory. It's like your home. You don't have to organize things into rooms and closets, but it makes it kind of hard to get what you need efficiently
As Ace wrote. Another reason is modularity and readability- structures give you a way to create/describe complex objects and treat/pass them as one thing. This make your code simple and readable from the one side and easy to maintain and modular from the other side. Actually, its exactly the reasons to use OOP- structs are one step towards classes...
Modulatrity and readability structurs give you a way to create complex object and pass them as one thing.
We can use data structures for many reasons: 1. To organise large amount of data, if we use data structures, it becomes easier to manage and retrieve data. 2. If we are not sure how much space we need for data say our data is growing dynamically. For example we have a website were n numbers of users can register so in such case we can use linkedlist which grows dynamically. 3. Like a Map in data structures which helps to organise data in key value pair. For example in our application I need to track everyday status of user, there I can create Map with key value pair to track status. 4. Google Maps geolocation can use Map data structures. Tree data structures can also be used to create Google Maps like application where it can show locations like Tree node. There are many real world applications of data structures where we explicitly need to use it. The more you would practice, the more you would learn yourself, why we need it? How it helps programmer to make life easier for them. Happy Coding!
Avoids the hassle of accessing multiple variables separately.
Yea that is it
Data structure also helps the compiler to allocate appropriate memory allocations and to prompt error messages when error is encountered.