1.当局部变量与全局变量发生冲突时以局部变量优先。 2.数组定义时n应为常量,不能是变量。 3.字符串结束标志为'\0',是转义字符,对应ASCII码值为0 "abcdef"默认最后为\0,省略了。 而“0”为字符0,对应ASCII为48. 4.求两个数最大值 intmain() { intx=10; inty=20; if(x>y)   printf("最大值为%d\n",x) else   printf("最大值为%d\n",y) return0; } 5.定义函数来求两个数最大值 Max(num1,num2)

  u1Ooy9So4KGW   2023年11月02日   71   0   0 全局变量字符串局部变量

1.eof:endoffile文件结束标志,值为-1 2.'\0'是字符串结束标志,隐藏在最后,不算字符串里的内容. 3.arr[n],n必须是常量。 4.原码除了第一位符号位以外(0+1-)其余按位取反是反码,再+1为补码 正数三码相同,以补码形式存储,负数不同,以补码存储。 5.后置:先使用,再 前置:先,再使用 6.&按位与 &&逻辑与:非0为真

  u1Ooy9So4KGW   2023年11月02日   48   0   0 按位与字符串补码

1.register存储器,计算机存储以存储器,高速缓冲区,内存,硬盘为主,速度逐渐变慢,容量变大。经常访问的可建议存在register中。 2.//typedef重命名 intmain(){ typedefunsignedintuint_3; uint_3num=-3; unsignedintnum2=-3; printf("%d%d\n",num,num2); return0; } 3.//static修饰局部变量,生命周期变长 voidtest(){ inta=2;//staticinta=2; printf("%d",a); a; } intmain(){ inti=0...

  u1Ooy9So4KGW   2023年11月02日   46   0   0 作用域链接属性源文件

1.define定义常量和宏 defineMAX(X,Y)(X>Y?X:Y) intMax(intx,inty) { if(x>y) returnx; else returny; } intmain(){ inta=10; intb=20; intmax1=Max(a,b);//函数 intmax2=MAX(a,b);//宏 printf("%d\n",max1); printf("%d\n",max2); return0; } 2.指针 intmain(){ inta=10; intp=&a; p=20;//解引...

  u1Ooy9So4KGW   2023年11月02日   46   0   0 操作符Max#define

1.结构体:复杂类型 structBook { charname[20]; shortprice; }; intmain(){ structBookb1={"C语言程序设计",55}; structBookpb=&b1; printf("%s\n",b1.name); printf("%d\n",b1.price); printf("%s\n",(pb).name);//结构体变量.成员 printf("%d\n",(pb).price); printf("%s\n",pb->name);//->结构体指针->成员 printf("%d\n",p...

关注 更多

空空如也 ~ ~

粉丝 更多

空空如也 ~ ~