I like to think of it as a giant wall of numbered Safe Deposit Boxes like at a Bank and every Box contains a piece of paper with a number on it.
It works to describe lots of circumstances. How do you explain what the ASCII characters 'A' and 'B' are? Everybody just agrees that a piece of paper with the number 65 means 'A' and 66 means 'B'. The same thing goes for encoding pictures/movies anything.
How do we store bigger things like the String "AB". We need 2 boxes. One to store 65 and one to store 66. It would make sense for these boxes to be next to eachother. Maybe the 'A' gets stored in box number 1000 and then 'B' gets stored in box 1001. How do we know that the String only has 2 characters in it? Maybe we store the number 0 in box 1002 to signal that that's the end of the String and it turns out that this way actually needs 3 boxes to store 2 characters.
Are there other ways I could store the String? How do I know how long the String [65, 66, 0]
is? I have to start at box 1000 and keep opening boxes until I get to one with 0 in it. Is there another way I could store my String? What if the first box held the length of my String? I could store [2 65 66]
and then if I need to know the length of my String I only need to open the first box. As long as me and everybody else knows what system I'm using it doesn't really matter which way I choose.
How do we know where our String is? We somehow need to know it starts in spot 1000. Either we wrote it in our code or we somehow have access to another box (a pointer) and inside that box on its piece of paper we write 1000 so that we know our String starts at location 1000.
Maybe you think it's stupid that 65 means 'A'. You could say 1 = 'A' and 2 = 'B' etc.
That system is perfectly fine too as long as when you share them with other people those people know what your system is.
We could keep going deeper and deeper but eventually we will have to come to the realization that the significance of what is written on the pieces of paper are whatever we as humans decide is the significance. We the programers decide whether a number in a box is an Integer, Fraction, Character, Pointer to another box, Instruction for the Machine, Pixel color for an Image.
Only the people who wrote the numbers on the paper can figure out whether 65 means 65, 'A', -99, Red, Infinity or an Orange Bucket.
It is like writing. What is the significance of a vertical line? Is it a lower case L? Is it the number 1? Is it part of some sort of drawing? Does it stand for a word in another language? Is it that thing above \
on my keyboard? The only way you can know the meaning of the line is if the person who drew it tells you.