Why data structures are used? And where it is implemented? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Why data structures are used? And where it is implemented?

When a program is executed , it is loaded into registers to hold values. And where are the data structures(DS) here? Is this DS like stack,queue are carried out in REGISTERS? Because i know cpu executes every program ! thakyou!

11th Oct 2018, 2:55 AM
Ben Druno
Ben Druno - avatar
2 Answers
+ 1
There is little difference for data structures verses smaller items like integers. Memory locations are allocated as needed for both based on their size. Compilers could optimize them into registers so no memory is used. But, if they don't get optimized away, they will be moved to a register as needed to be processed. The location used in memory depends on how it is allocated: global, local (stack based), or pointer (heap based).
11th Oct 2018, 2:59 PM
John Wells
John Wells - avatar
0
Look into Embedded C. There is a really good tutorial on YouTube called Embedded C programming I believe. There are 27 lessons I believe. It’s hands on. The lessons have a ton of info in them and they go rather quickly. Good news is the guy provided typed notes for each lesson. Very interesting and deals with how memory in RAM and a CPU works.
12th Oct 2018, 4:56 AM
Ryan
Ryan - avatar