Yeah, this has been reviewed for too long that I decided to make it into its own post in which you can visit it [here]({{ site.baseurl }}{% post_url 2018-08-7-simplified-introduction-to-the-memory-and-memory-management %}).
Anyway, here's a summarized version of it: the memory is a part of the computer that is used to hold and store data; in context of
computer science, the memory is mostly referring to the RAM which is a type of memory that can hold and transfer data at a higher
rate compared to other forms of storage such as a hard drive disk (HDD) and a solid state drive (SSD).
The program we write relates to it as the memory gives the resources that made our program to be able to run in the first place.
As we go on, the memory works by dividing the resources for different purposes but the main thing that we are going to discuss is
the stack and the heap which is really just a one shared memory pool.
The stack (or the call stack) is a part of the memory segment that manages automatic variables and the flow of the program
through the stack frames. These stack frames are based on the function calls as the program is running. Only the most recent
stack frame (effectively, the most recent function call) is currently active and all previous functions will pause executing.
The most recent stack frame may only be *popped out* when the function that calls it finishes executing. There is a limit
on how many stack frames the program can only run and exceeding it may cause a *stack overflow*.
Next is the heap where the dynamic memory allocation takes place. Both of the heap and the stack are in the same segment but
traditionally, they are located at different spots of the memory and grow in separate directions. The heap, unlike the stack,
have no form of organizing data and instead allocate them at random locations. There is no order of deallocation either, thus
we need to free it ourselves in any order. Leaving the allocated memory is considered a dangerous move since it may cause a
*memory leak* which will render the block of memory unavailable for the rest of the usage until the operating system reboots.
Also, pointers. They are important, too. Seriously speaking, pointers are indeed a useful tool once you get to understand them.
We can have two variables having the same value but at different address, pointers allows us to pinpoint only the variable that
we really need by storing its address. And that's really all pointer is about: addresses. We can compare it to URLs which
are addresses to the files. Now there are URL that can lead you to the same file but the location is entirely different, we could
get it from a different site. Now that we have an identifier that contains the address of the variable, we can access it by
*dereferencing* it. A dereferencing or an indirection, as others might call it, is the process of going to that address and
getting the value inside of that address.
{% highlight c linenos=table %}
// the entirety of pointers in C
// declaring a variable
int number = 42;
// declaring a pointer variable with the type of the value
int *number_ptr = &number;
// dereferencing the pointer
printf("%i\n", *number_ptr);
{% endhighlight %}
### Growth mindset
The growth mindset is one of the most important research has done by [Carol Dweck](https://en.wikipedia.org/wiki/Carol_Dweck), a
psychologist researching on the motivation of the people and how they do what they want to do.
Long ago, I've read [something about the growth mindset in one of Khan Academy's post](https://www.khanacademy.org/about/blog/post/95208400815/the-learning-myth-why-ill-never-tell-my-son-hes)
and that very important takeaway I've had with that article is the fact that our brain changes. One of the most interesting
tidbits that has been said over the post is how one would start to change his thoughts about intelligence, by simply being
exposed to a research post about growth mindset and internalizing it into our routines. Simply reading the causes and effects already changes our mind in a way due to the new information our brain has received. Our brain now knows that we grow by our
mistakes, not by the number of the right answers we made. Or by embracing struggles and challenges, we can learn anything
combine that on how to start learning in the right pace on the right place.
I go back on that article for those times I struggle just to remind myself that we grow through our mistakes. By looking at what
we made wrong, we can spark some sort of discussions and that's where learning can take place. So, yeah, if you want to change
your mindset, you should immerse yourself in these topics and internalize it. This is pretty much a very important stuff for
yourself, in my opinion. With the internet being a very large place of information, you can start to get on what you have today.
### Arduino
Recently bought an Arduino and a new electronic kit so I'm very raring to go with learning electronics even more. Anyways,
Arduino is a programmable circuit board (or a microcontroller) that allows you to create various devices covering from a
thermostat, a microphone, an LED screen with different color patterns flashing at an interval, a digital clock,
a motion detector, or a simple button circuit that will play a sound when pressed, anything you can imagine as long as you have
a plan in mind. Since I'm just testing out the waters and I'm not very familiar with the basics of electronics much yet, I'm just
going to do the last thing in the previously mentioned list of projects which is a simple sound button circuit. I've seen a
tutorial of it long ago except that it uses a jelly bear candy that acts as a button with two rods inside of it that triggers the
sound when those two rods touch. Sadly, I can't find it anymore (if you do, please notify me, I want to see it again) but
nonetheless memorable, funny and amazing, in a way.
### [Developing Confidence, Finding Happiness, and Saying "No" to Millions from *The Tim Ferris Show*](https://tim.blog/2015/12/14/derek-sivers-on-developing-confidence-finding-happiness-and-saying-no-to-millions/)
This is a YouTube video that is covers the topic given by this book, [A Mind For Numbers by *Barbara Oakley*](https://www.goodreads.com/book/show/18693655-a-mind-for-numbers).
Most of the topics found on the book can also be gotten from a very famous Coursera course, [Learning How To Learn](https://www.coursera.org/learn/learning-how-to-learn/)
which the author, Barbara Oakley, is included as one of the instructors of the course. It's a very good video covering the
topics of the book, acting as a summary and an informative video. Of course, the only thing you should do is to apply it.
Hopefully, you're not stuck on a YouTube watching spiral that is still happening to me after watching the video so you should
start applying it immediately or as soon as possible.