C和指针

  |  

摘要: 《C和指针》笔记,共 56 页。

【对算法,数学,计算机感兴趣的同学,欢迎关注我哈,阅读更多原创文章】
我的网站:潮汐朝夕的生活实验室
我的公众号:算法题刷刷
我的知乎:潮汐朝夕
我的github:FennelDumplings
我的leetcode:FennelDumplings


基础

  • ANSI C 相比 K&R C 的变化
  • white space(空白符)
  • trigraphs(三字母词)
  • escape sequence(转义序列)
  • C Keywords(保留字)
  • Basic data type(基本数据类型)
  • integer(整型)
  • literal(字面值)
  • Enumerated type(枚举类型)
  • Float-Point type(浮点型)
  • pointer(指针)
  • string(字符串)
  • typedef
  • const
  • scope(作用域)
    • block scope
    • file scope
    • prototype scope
    • function scope
  • Linkage(链接)
    • 3 types
      • none
      • internal
      • external
    • static
    • extern
  • Storage Class(内存变量的存储类型)
    • 3 个位置
      • ordinary memory
      • runtime stack
      • hardware register
  • 变量定义位置
    • 定义在 block 外 -> static memory
    • 定义在 block 内 -> stack
  • register keyword
  • initialization(初始化)
  • Statement
  • Operator
    • arithmetic
    • shifting
    • bitwise
    • assignment
    • compound assignment
    • Unary
    • sizeof
    • (type)
    • ++, —
    • relational
    • logical
    • conditional
    • comma
    • subscript
    • function call
    • structure member
  • boolean value
  • L-value, R-value
  • implicit type conversion
  • Arithmetic conversion
  • Pointer(指针)
  • address vs contents
  • pointer constant
  • pointer to pointer
  • pointer expression
  • pointer arithmetic
  • function
  • prototype
  • argument
  • ADT
  • recursion
  • variable argument list
  • array
  • subscript
  • declaring array parameter(声明数组参数)
  • array initialize
  • Multidimensional arrays
    • subscript
    • as function argument
    • initialize
  • automatic sizing
  • array of pointer

ANSI C 相比 K&R C 的变化


  • white space(空白符)
  • trigraphs(三字母词)
  • escape sequence(转义序列)

  • C Keywords(保留字)
  • Basic data type(基本数据类型)
  • integer(整型)

  • literal(字面值)
  • Enumerated type(枚举类型)

  • Float-Point type(浮点型)
  • pointer(指针)
  • string(字符串)
  • typedef
  • const

  • scope(作用域)
    • block scope
    • file scope
    • prototype scope
    • function scope

  • Linkage(链接)

    • 3 types
      • none
      • internal
      • external
    • static
    • extern
  • Storage Class(内存变量的存储类型)

    • 3 个位置
      • ordinary memory
      • runtime stack
      • hardware register
  • 变量定义位置
    • 定义在 block 外 -> static memory
    • 定义在 block 内 -> stack

  • register keyword
  • initialization(初始化)

  • Statement

  • Operator
    • arithmetic
    • shifting
    • bitwise
    • assignment
    • compound assignment
    • Unary
    • sizeof
    • (type)
    • ++, —
    • relational
    • logical
    • conditional
    • comma
    • subscript
    • function call
    • structure member



  • boolean value
  • L-value, R-value
  • implicit type conversion
  • Arithmetic conversion

  • Pointer(指针)
  • address vs contents

  • pointer constant
  • pointer to pointer
  • pointer expression

  • pointer arithmetic

  • function
  • prototype

  • argument
  • ADT
  • recursion

  • variable argument list

  • array
  • subscript

  • declaring array parameter(声明数组参数)
  • array initialize
  • Multidimensional arrays
    • subscript
    • as function argument
    • initialize
  • automatic sizing
  • array of pointer



String, Character, Bytes

  • string length
    • strlen
  • unrestricted string function
    • strcpy
    • strcat
    • strcmp
  • length-restricted string function
    • strncpy
    • strncat
    • strncmp
  • basic string search
    • find a character
      • strchr
      • strrchr
      • strpbrk
    • find a substring
      • strstr
    • find prefixes
      • strspn
      • strcspn
    • find tokens
      • strtok
  • character operation
    • iscntrc
    • isspace
    • isdigit
    • isxdigit
    • islower
    • isupper
    • isalpha
    • isalnum
    • ispunct
    • isgraph
    • isprint
    • tolower
    • toupper
  • memory operation
    • memcpy
    • memmove
    • memcmp
    • memchr
    • memset
  • Structure
    • struct
    • typedef struct
  • bit field(位域)
  • Union
  • dynamic memory allocation
    • malloc
    • free
    • calloc
    • realloc
  • advanced pointer topics
  • pointer to function(函数指针)
  • callback function(传递函数指针)
  • Jump table(函数指针的数组)
  • String literal(是一个指针)
  • the preprocessor
  • Macro(宏)
    • #define
    • #undef
  • contitional compilation
    • #if, #elif, #else, #endif
    • #ifdef, #ifndef
  • file inclusion
    • library include #include <...>
    • local include: #include "..."
  • other
    • #error
    • #line
    • #progma
  • #progma para
  • IO function
    • perror
    • exit
  • ANSI IO
    • stream
    • FILEs
    • standard IO constants
  • opening stream
    • fopen
    • freopen
    • fclose
  • Character IO
    • fgetc
    • getc
    • getchar
    • fputc
    • putc
    • putchar
    • ungetc
  • unformatted line IO
    • fgets
    • gets
    • fputs
    • puts
  • formatted line IO — scanf family
    • fscanf
    • scanf
    • sscanf
    • format code
  • formatted line IO — printf family
    • fprintf
    • printf
    • sprintf
    • format code
  • binary IO
    • fread
    • fwrite
  • flushing and seeking function
    • fflush
    • ftell
    • fseek
    • rewind
    • fgetpos
    • fputpos
  • changing the buffer
    • setbuf
    • setvbuf
  • stream error function
    • feof
    • ferror
    • clearerr
  • Temporary files
    • tmpfile
    • tmpram
    • remove
    • rename

  • string length
    • strlen
  • unrestricted string function
    • strcpy
    • strcat
    • strcmp

  • length-restricted string function
    • strncpy
    • strncat
    • strncmp

  • basic string search

    • find a character
      • strchr
      • strrchr
      • strpbrk
    • find a substring
      • strstr
    • find prefixes
      • strspn
      • strcspn
    • find tokens
      • strtok
  • character operation

    • iscntrc
    • isspace
    • isdigit
    • isxdigit
    • islower
    • isupper
    • isalpha
    • isalnum
    • ispunct
    • isgraph
    • isprint
    • tolower
    • toupper

  • memory operation
    • memcpy
    • memmove
    • memcmp
    • memchr
    • memset

  • Structure
    • struct
    • typedef struct

  • bit field(位域)

  • Union

  • dynamic memory allocation

    • malloc
    • free
    • calloc
    • realloc
  • advanced pointer topics

  • pointer to function(函数指针)

  • callback function(传递函数指针)
  • Jump table(函数指针的数组)
  • String literal(是一个指针)
  • the preprocessor

  • Macro(宏)
    • #define
    • #undef

  • contitional compilation
    • #if, #elif, #else, #endif
    • #ifdef, #ifndef
  • file inclusion
    • library include #include <...>
    • local include: #include "..."
  • other
    • #error
    • #line
    • #progma


  • #progma para

  • IO function
    • perror
    • exit
  • ANSI IO
    • stream
    • FILEs
    • standard IO constants

  • opening stream
    • fopen
    • freopen
    • fclose

  • Character IO
    • fgetc
    • getc
    • getchar
    • fputc
    • putc
    • putchar
    • ungetc

  • unformatted line IO
    • fgets
    • gets
    • fputs
    • puts
  • formatted line IO — scanf family
    • fscanf
    • scanf
    • sscanf
    • format code


  • formatted line IO — printf family
    • fprintf
    • printf
    • sprintf
    • format code

  • binary IO
    • fread
    • fwrite

  • flushing and seeking function
    • fflush
    • ftell
    • fseek
    • rewind
    • fgetpos
    • fputpos

  • changing the buffer
    • setbuf
    • setvbuf

  • stream error function

    • feof
    • ferror
    • clearerr
  • Temporary files

    • tmpfile
    • tmpram
    • remove
    • rename


Standard library

  • Integer function
    • abs, labs
    • div, ldiv
  • Random number
    • rand
    • srand
  • string conversion
    • atoi, atol
    • strtol
  • floating-point function
    • 三角函数
    • 反三角函数
    • 双曲三角函数
    • 指数函数, 对数函数
  • floating-point representation
    • frexp
    • ldexp
    • modf
  • power
    • pow
    • sqrt
  • other
    • floor
    • ceil
    • fabs
    • fmod
  • string conversion
    • atof
    • strted
  • date and time function
    • processor time: clock
    • time of day: time, ctime, difftime, gmtime, localtime
  • tm’s fields
  • asctime
  • strftime
  • nonlocal jumps
  • signals
    • signal name defined by standard
      • SIGABRT
      • SIGFPE
      • SIGILL
      • SIGSEGV
      • SIGINT
      • SIGTERM
    • processing signal
      • raise
      • signal
    • signal handler
  • print variable argument
    • vprintf
    • vfprintf
    • vsprintf
  • execution environment
    • abort
    • atexit
    • exit
    • assert
    • getenv
    • system
  • sorting and searching
    • qsort
    • bsearch
  • locales
    • setlocale
  • setlocale categories
  • Numeric and monetary formatting
    • localeconv
  • string and locale
    • strcoll
    • strxfrm

  • Integer function
    • abs, labs
    • div, ldiv
  • Random number
    • rand
    • srand
  • string conversion
    • atoi, atol
    • strtol

  • floating-point function
    • 三角函数
    • 反三角函数
    • 双曲三角函数
    • 指数函数, 对数函数
  • floating-point representation
    • frexp
    • ldexp
    • modf

  • power
    • pow
    • sqrt
  • other
    • floor
    • ceil
    • fabs
    • fmod
  • string conversion
    • atof
    • strted

  • date and time function
    • processor time: clock
    • time of day: time, ctime, difftime, gmtime, localtime

  • tm’s fields
  • asctime
  • strftime

  • nonlocal jumps

  • signals

signal name defined by standard

SIGABRT
SIGFPE
SIGILL
SIGSEGV
SIGINT
SIGTERM

processing signal

raise
signal

signal handler

  • print variable argument
    • vprintf
    • vfprintf
    • vsprintf
  • execution environment
    • abort
    • atexit
    • exit
    • assert
    • getenv
    • system

  • sorting and searching
    • qsort
    • bsearch
  • locales
    • setlocale

  • setlocale categories

  • Numeric and monetary formatting

    • localeconv
  • string and locale

    • strcoll
    • strxfrm


Share