Master of Memory: Accelerated learning, education, memorization - MMem 0357: Memorizing C programming variables
Episode Date: July 21, 2015Moharsh asks about memorizing variables in C programming. I give some basic mnemonic suggestions. What do you want to learn? Leave your question at http://MasterOfMemory.com/. Music credit: Maurice... Ravel’s String Quartet, 2nd movement, performed by the US Army Band.
Transcript
Discussion (0)
Master of Memory 357
Welcome to Master of Memory.
I'm Timothy and I'm here to answer your accelerated learning questions every day
and to inspire and empower you to learn anything you want to learn faster than ever.
Moharsh submitted a written question at masterofmemory.com
about memorizing the types of variables when programming in C.
So this is a very quick
and simple application of some mnemonics. I've chosen the four most important
types of variables and I'll show you how you can quickly take both the names of
these variables and what they represent, tie them together, and always remember
one from the other. So we have char for character, int for integer, float, and double, both of which
are for decimal numbers. So an easy way to remember that char is for a character, C-H-A-R,
is to imagine a tiny piece of charcoal that writes only one letter because it's so small.
You have a teeny tiny piece of charcoal you try to write on a wall, but you can only write one letter. And that's what the char variable represents.
For an integer, it's pretty simple. You just have int. It's an integer. For floats and doubles,
you want a more complex mnemonic. So what you can do is imagine that you have a small sailboat floating in the water with another larger boat next to it.
The smaller one has a fraction of a sail, but the bigger one has 1.5 sails.
So it has one and a half sails.
So your smaller boat is floating a little higher.
It's lighter and it's floating higher.
And that's the float.
And so you can see it has a fraction of a sail to represent that it works for decimal numbers. The
other boat is about twice as big and it has twice as many sails so it's double
it's a double and it also represents decimal numbers but it can handle larger
decimal numbers. So there we have it those are our four variable types. Now if
you wanted you could store
these in a memory palace in a particular way so that you can represent what these are for. So
maybe you have a memory palace for all of the variables in C, all the types of variables.
Maybe you have all of the types of variables that represent numbers in the bathroom, and you have the ones
that represent characters and letters in a different room. So you would put the float and the double
in the bathtub, and then you'd put the int for the integer in the sink. You'd want to come up with
some visual way to represent that. Since we already know int is integer, just sort of automatically,
we could then go ahead and tie it to the location by now creating an image for it. Since int isn't
a word in the English language, it's going to be fairly personal what you
choose to use to represent int. I would probably use an ant that's in the shape
of an eye, but that might not work for somebody else, so just come up with a
mnemonic for that. But there we have an ant and the two boats in the bathroom, and we can easily remember that those are all grouped together.
Another room is where we have the char for the single character, and then we could place other
variables that have to do with words and letters in that other room as well. So you not only have
these mnemonics for each one, you have them organized in a memory palace to show what belongs where and how they're categorized.
I hope that gives you some starting point, at least Moharsh, and I'd appreciate an iTunes review from you if you can leave one.
Just go to iTunes and leave us a rating and a review.
And these have a multiplying effect as to how many people iTunes allows to see the show.
So for anyone who's gotten any benefit
from this show, please leave us a review in iTunes. What do you want to learn? The world's
knowledge can be yours. Leave your learning request at masterofmemory.com slash question,
and I'll talk to you again soon.