12 2022 档案

摘要:git blame -L 1460(行号) path/filename 阅读全文
posted @ 2022-12-16 09:53 我们都不是哈士奇 阅读(19) 评论(0) 推荐(0) 编辑
摘要:代码如下 全局变量和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 阅读全文
posted @ 2022-12-13 19:09 我们都不是哈士奇 阅读(21) 评论(0) 推荐(0) 编辑
摘要:1.本地变量有本地生存期和局部作用域 2.静态变量具有全局生存期和局部作用域 3.static具有全局生存期和局部作用域 阅读全文
posted @ 2022-12-13 17:30 我们都不是哈士奇 阅读(35) 评论(0) 推荐(0) 编辑
摘要:1.结构体的初始化 #include <stdio.h> struct date{ int month; int day; int year; }; int main() { struct date today = {7,30,2020}; struct date thismonth = {.mon 阅读全文
posted @ 2022-12-13 15:47 我们都不是哈士奇 阅读(36) 评论(0) 推荐(0) 编辑
摘要: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++ 阅读全文
posted @ 2022-12-13 12:59 我们都不是哈士奇 阅读(121) 评论(0) 推荐(0) 编辑
摘要:#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 阅读全文
posted @ 2022-12-11 21:57 我们都不是哈士奇 阅读(58) 评论(0) 推荐(0) 编辑