TODO
https://news.ycombinator.com/item?id=22865357 : C 标准在hn 上的提问。 https://news.ycombinator.com/item?id=22888318 : 嵌入式的内容 http://nickdesaulniers.github.io/blog/2019/05/12/f-vs-f-void-in-c-vs-c-plus-plus/
https://github.com/rby90/project-based-tutorials-in-c https://github.com/angrave/SystemProgramming : C 语言教程,快速浏览,查漏补缺
好玩的东西
https://github.com/taylorconor/quinesnake : 我记得还有一个使用 printf 实现 xxoo 的游戏
You don’t know C
C Traps and pitfalls
- int shall not has leading zero
int a = 012; - token analyzer is greedy, which means nested commnet is invalid
/**/*/ equals */ not nothing ! - use
typedefto simplify function pointer typetypedef void (*FUN_PTR)(int a, int b); void handler(int & sum, FUN_PTR f); - operator priority
- logical < arithmetic
- shift < arithmetic shift > relation
- ; ```c // after if and while if (flag); printf(“hello”)
if (flag) printf(“hello”)
5. Compute order : only `||` `&&` `?:` `,`
```c
i = 0;
while(i < n){
y[i] = x[i++];
}
i ++ maybe calcauted before y[i] assigned, maybe after.
-
return value for
mainis important - getchar return int
int main(){ int c; while((c = getchar()) != EOF){ putchar(c); } return 0; } - Linker
- use
externto declare there is a variable. - define a variable : declare and allocate memory
- use
C is not just C
C is os, compiler and arch.
Pointer and array
Pointer and array is not the same thing !
- C only has one dimension array, high dimension are emulated !
- Only two thing we can do to C array:
- get array size
- access the pointer pointing to begining of array
- shorthand
int b[10]; c[0] = 12; 0[c] = 12; // not recommended - As function parameter ,array will be transform to pointer automaticall. And this is the reason why both of pointer and array call pass to pointer parameter. ```c void func(int a[10][10]){
}
void func(int (*a)[10]){
}
But this kind of transformation is only appear in function parameter.
```c
extern char * hello;
extern char [] hello;
C 语言的额外审查
https://rules.sonarsource.com/c/
c 的一些库
https://github.com/attractivechaos/klib
整理的挺好的
https://devdocs.io/c/numeric/math/acosh
https://blogs.gentoo.org/mgorny/2024/09/23/overview-of-cross-architecture-portability-problems/
本站所有文章转发 CSDN 将按侵权追究法律责任,其它情况随意。