A Device’s RAM is like a garage full of boxes. each box is a variable, the contents of the box are the data stored in the variable. Arrays are the stacks of boxes each holding related data. Pointers tell you where to find the boxes. Many boxes contain garbage (garbage values) untill you initalise the variable (box) and put something meaningfull in it. An error (e.g. stack overlow) occurs when you try to put a box (variable) outside the garage (maybe in your neighbors garage). Problems also occur if you try to put something bigger than the box in the box (e.g. putting a 64 bit value in a 32 bit box) or put the wrong shape item (data type) in the box (e.g. putting a char into an int).
this analogy was copied from my original prize winning post in a contest for electronics analogies here.
what are your favorite electronics analogies? post them in the comments!
this analogy was copied from my original prize winning post in a contest for electronics analogies here.
what are your favorite electronics analogies? post them in the comments!