Skip to content

Latest commit

 

History

History
112 lines (99 loc) · 2.05 KB

week1.md

File metadata and controls

112 lines (99 loc) · 2.05 KB

CS50 Week1 C

Command line interface 命令行

  • 操作系统
  • Terminal vs Shell
  • 常用命令
    • mkdir make directory
    • ls list
    • cd change directory
      • 相对路径、绝对路径
    • cp copy
    • mv move
    • rm remove
    • rmdir remove directory
    • clear clear
    • man manual
  • 快捷使用
    • ctrl+l
    • ctrl+a
    • ctrl+e
    • ctrl+u

VSCode

https://code.visualstudio.com/

课程内容

human → source code → compiler → machine code

correctness, design, style

#include <stdio.h>

int main(void)
{
    printf("hello, world\n");
}
  • make, clang, gcc

  • 分号;

  • \n

  • header files - libraries

  • https://manual.cs50.io/

  • Data types

  • format code

    • %c %s %i %f %.2f
  • %%

  • = assignment

  • == equal

  • ++ +=

  • % 求余、取模

  • Logical Operators

    • ==
    • !=
    • !
    • ||
    • &&
  • Conditionals

    • If
    • If … else …
    • If … else if … else …
    • switch…case…
    • ?:
  • Loop

    • while
    • for
    • do…while…
  • Magic Numbers

    • #define
  • Overflow

    • 千年虫
    • 2038-01-19
  • type casting

  • 推荐书 <The C Programming Language>