摘要:
git blame -L 1460(行号) path/filename 阅读全文
摘要:
代码如下 全局变量和static对多线程来讲是不安全的 #include <stdio.h> int *f(void); void g(void); int main(int argc,char const *argv[]) { int *p=f(); printf("*p=%d\n",*p); g 阅读全文
摘要:
1.本地变量有本地生存期和局部作用域 2.静态变量具有全局生存期和局部作用域 3.static具有全局生存期和局部作用域 阅读全文
摘要:
1.结构体的初始化 #include <stdio.h> struct date{ int month; int day; int year; }; int main() { struct date today = {7,30,2020}; struct date thismonth = {.mon 阅读全文
摘要:
1.strlen与sizeof(返回字符串的长度,不包括结尾的0) size_t strlen(const char *s) #include <stdio.h> int getLength(char *s) { int cnt = 0; while (s[cnt] != '\0') { cnt++ 阅读全文
摘要:
#include <stdio.h> int main(int argc,char const *argv[]) { int ch; while ((ch=getchar()) !=EOF) {//ctrl+z就是EOL putchar(ch); } printf("sp\n"); return 0 阅读全文