
C语言
00汪汪00
一杯茶足矣
展开
-
C语言中的Sizeof
1.C11标准中的sizeof Constraints 1 Thesizeofoperator shall not be applied to an expression that has function type or an incomplete type, to the parenthesized name of such a type, or to an expression that designates a bit-field member. The_Alignofope...原创 2020-05-11 16:30:38 · 348 阅读 · 0 评论 -
side effect和Sequence points
1.C11中的side effect(副作用) Accessing a volatile object, modifying an object, modifying a file, or calling a function that does any of those operations are allside effects,which are changes in the state of the execution environment.Evaluationof an expre...原创 2020-05-11 16:20:28 · 243 阅读 · 0 评论 -
C语言中++i和i++的详细区别
1.++i ++i和等同于1 i = i + 1;2.i++ i++可以等同于1 int temp = i; // 一个与i类型相同的临时变量2 i = i + 1;3.相同点和不同点 相同点:i最后都会被加1; 不同点:在i++中多了一个与i类型相同的临时变量,i++是右值,++i是左值。 例子1: 1 int a = 1, b = 2; 2 int *pt; 3 pt = &a; 4 5 pt++ = &b; //原创 2020-05-11 16:14:05 · 6870 阅读 · 0 评论 -
字符常量 字符串 sprintf
1.区分'A'和"A" 'A'是一个字符常量,一个字节。"A"是字符串,两个字节,包括'A'和'\0'。即在编译时'A'就是相当于一个宏定义,一个常数,而"A"必须在内存中,有内存地址。//functionvoid example(char *tm);char buf;char *pt;pt = &buf;*pt = 'A'; // 正确pt = "A...原创 2020-04-15 16:30:49 · 625 阅读 · 0 评论