Sunday, September 6, 2020

bool, char, int, float, long, double, .... = data types in C

bool      1 byte
char      1 byte
int         4 bytes
float      4 bytes                    (in most systems these days, these are the amount of space these data
long      8 bytes                      types are most likely to take up)
double  8 bytes
string    ? bytes
....
....


cs50, lec2


design decisions - not only get problems solved, but solved well

when at facebook , google, microsoft ......

when huge amounts of data and users

design decisions could result in significant cost, cpu cycles, or memory .......



cs50, lec2



reasonable people may disagree on: (1) style (2) design

what style is better, more readable, more maintainable


what design is better




cs50, lec2

when cannot solve problem - go for jog, or rubber duck, or nap

many people have the experience of

when cannot solve problem in programming when using debugger etc.

go for jog

change mental mindset

many have the experience of solving problem when taking nap

or talk through your code with a rubber duck



cs50, lec2




help50, printf, debug50, check50, style50

help50 ........... correctness
printf ............. correctness
debug50......... correctness
check50 ......... correctness
style50 ........... style




cs50, lec2



style50 ........ important ........ code maintainability

nothing worse than being unable to understand what you are looking at when you come back after a while to maintain your code


cs50, lec2


check50 is representative of the real world process of testing one's code repeatedly

cs50, lec2, around 29:00 mins 處 ....... how to use the check50 test


check50 checks whether your program does what is required,

but it is actually a "test"




Using a debugger is a very important life long skill

not just for C but for other languages as well

cs50, david malan


CTRL + C ...... this jumps out of programs like the cs50 ide debugger

CTRL + C ........ jumps out out of the window, kills the debugger, and goes back to the code and terminal window view


"C" stands for cancel