This is where it gets kinda hard. So stay with me.
Now we have to worry about memory management. Why do we have to? Well, memory is like everything else, it's finite. There is only so much to go around. This leads us to pointers.
Pointers is sort of like a address on the memory. Think of like it's "pointing" to where in the computer's memory the data is stored.
There are two conventions in C that denotes pointers
There is the * and &. Any time you see these two symbols before something, it denotes a pointer. For example, *myInt and &myInt both means, they are pointers of myInt.
Essentially, myInt = *myInt. You can manipulate the pointers like you would the actual variable.
Once you make a pointer, you can place it in code in place of the variable. Memory in the computer are made up of blocks. Depends on the type of computer, and the bits, you can have a little or a lot. But no matter how much memory you have, bad management can lend to poor results.
This is how I understand pointers. Not sure if it is entirely correct but I think I got the gist of
it.
So remember a pointer points to the address of the data in the memory. That is the take away message from pointers. I'm told once you start using pointers, you'll use pointers in everything.
We'll see more example of this once we get into coding.

No comments:
Post a Comment