Today was a long day but I got through the “Strict Mode” document on MDN. It was long, and a lot of the material felt fringe to my naïve mind. I was definitely tired when I started studying and the topic I chose to focus on DID NOT help. LOL. At this point I just have to try and get some rest and do better tomorrow. I need to get some pep in my step. I am not my usual self.
TLDR;
Okay, so here are the highlights of what I did:
- I continued cleaning up my notes on arrays and pointer return types in
C
. I tried to solve a puzzle from an article. I got all the calculations wrong on my initial attempt but I was able to breakdown how the solution was derived for the first two. I definitely need to write down the steps. - I read through the MDN Web Docs on Strict Mode. Like I said above. It wasn’t fun. I’m going to write some notes on the key features of Strict Mode. I will only build sections for the more fringe topics, since I haven’t even used them before. Hopefully, if and when I run into them I will have a space to write notes and review this material again. One thing I find depressing is that you read some docs, realize how little you know a language than question everything you know until you wonder how good of a developer am I really. I am clearly not in the best mood so I will discount this thought process LOL. Just sharing, maybe you can relate, or not. Either way step by step we can all improve so how much we know today is irrelevant.
C Puzzle on Array and Pointer Arithmetic
// A C/C++ puzzle, predict the output of following program
int main(){
char arr[5][7][6];
char (*p)[5][7][6] = &arr;
/* Hint: &arr - is of type const pointer to an array of
5 two dimensional arrays of size [7][6] */
printf("%d\n", (&arr + 1) - &arr);
printf("%d\n", (char *)(&arr + 1) - (char *)&arr);
printf("%d\n", (unsigned)(arr + 1) - (unsigned)arr);
printf("%d\n", (unsigned)(p + 1) - (unsigned)p);
return 0;
}
Output:
1
210
42
210
Conclusion
That’s all for today. This is my sixth round of the “#100daysofcode” challenge. I will be continuing my work from round five into round six. I am currently working through the book “Cracking the Coding Interview” by Gayle Laakmann McDowell. My goal is to become more familiar with algorithms and data structures. This goal was derived from my goal to better understand operating systems and key programs that I use in the terminal regularly e.g. Git. This goal was in term derived from my desire to better understand the fundamental tools used for coding outside of popular GUIs. This in turn was derived from my desire to be a better back-end developer.
I have no idea if my path is correct but I am walking down this road anyways. Worst case scenario I learn a whole bunch of stuff that will help me out on my own personal projects.