2017.6.18 CS50 week 4 筆記
紀錄時間: 1000~1400
- int tmp = a; //交換
- a = b;
- b = tmp;
- 如果設定變數(variable)但還沒指定變數值(value),變數值會變亂碼
tray 餐盤
rectangular 矩形
- string變數只是儲存空間的"地址"(箭頭),標示字串儲存的第一個位置
- int s = get_string(); // s |Z|e|d|/0|
- // 123 123 124 ...
- int t = get_string(); // t |Z|e|d|/0|
- // 234 234 235...
claymation 黏土動畫
- char *s => "變數s"是char pointer(指標)
- molloc(7) => 給7 byte的儲存空間
- &s, &t
proverbial 眾所皆知的、諺語的
- *x = 42; //不代表"x"的地址變42,是改變地址的值為42
- x = molloc(sizeof(int)); //給"x指標"一些記憶體儲存
dereference 逆向引用
- pointer需要給空間(pointee)來儲存實際的值
- 給了空間之後才能dereference
- 其他pointer可以指到同一個空間
adversary 對手
- hexadecimal: 0~9, a, b, c, d, e, f 共16個數
encapsulate 將...封入/裝入膠囊,壓縮
- structure儲存方法: student[i].name = get_string();
- fopen("students.csv", "w")
- fprintf(file, "s%,s%\n", student[i].name, studnet[i].drom)
- fclose(file)
- csv = comma separated value,comma = ,(逗點)
maliciously 惡意的
留言
張貼留言