随笔分类 - C 语言
摘要:struct student { int age; char *name; }; struct student one ={23,"zefeng"}; struct student two = {55,"fengzi"}; two.age=99; struct student all[2]={one
阅读全文
摘要:a的b次方 int pow(int a,int b){ if(b<0)return 1; return pow(a,b-1)*a;}
阅读全文
摘要://extern外部函数:定义的函数能被本文件访问和其他文件访问,默认情况下所有函数都是外部函数1>不允许同名 2>默认都是所有函数都是外部 //static内部函数:定义的函数只能被本文件访问,其他文件不能访问 1>允许同名 extern void test(){ printf("外部函数,默认情
阅读全文
摘要:结构体 typedef struct{ char *Sname; int age;}structName; 枚举 typedef enum{ oneEnum=1, twoEnum,}enumName; 函数指针宏定义 typedef int (*p)(int ,int);// int (*p)(in
阅读全文
摘要:预编译指令的作用域:从编写指令的那一行开始,一直到文件结尾 宏名一般用大写 或K开头其他小写 #define name 23 //局部宏只对下文有效 printf("%d",nameString);//错误❌ int arr[name]={23,23,4,34}; #undef name print
阅读全文
摘要:结构体 结构体所占据的存空间是成员变了最大的存储变量的倍数 struct person{ int age; double height; char * name; }; struct person per={.age=12.12,.name="zefeng",.height=23}; per.nam
阅读全文
摘要:int * p; //p指向int类型的数据的指针 (存放int类型内存地址的内存) int pp=23; p=&pp; *p () printf("p===%d",*p); 指向指针的指针 int o=22; int *q=&o; int **qq=&q; **qq=32; printf("o==
阅读全文
摘要:int arr[];错误 int arr[23]; arr={23,23}错误(只有在定义数组时同时初始化) int count =3; int arr[count] ={23,23,23}错误 (必须为常量)如果想定义数组的同时初始化,数组个数必须是常量 数组名就是数字的地址 字符串 \0 的
阅读全文
摘要:int numeber=1010; printf("%d\n",numeber); int numeber1=0b1100; printf("二进制 0b1010=%d\n",numeber1); int numeber2=014; printf("八进制 010=%d\n",numeber2);
阅读全文
摘要:include 倒入头文件中所有文件 系统自带<> 自定义 "" 相对路径 名称/名称/....文件名 绝对路径 /名称/名称/....文件名
阅读全文
摘要:1.算术运算 +-*/%(取余) 取余结果的正负只跟%左边的数值有关 %两边都是正数 3/2如果想获得double 必须分母或分子其中一个是double doule a =3.0/2 ; 2.赋值运算 int a=10; int b; b=a++; a=>>11, b=>>10; b=++a; a=
阅读全文
摘要:1.内存寻址由大到小,优先分配内存地址比较大的字节给变量 2.变量越先定义,内存地址就越大 3.取得变量地址:&变量名 4.输出地址:%p
阅读全文
摘要:char 1字节int 4 字节 float 4 字节 double 8 字节
阅读全文
摘要:数据分类:动态数据和静态数据 静态数据:一些永久性数据,存硬盘中; 存储时间长 动态数据:在程序运行过程中,存储内存中;关机数据删除 1kb =1024B 一个字节 1Byte=8 Bit = 01010101 1MB=1024KB 1GB=1024MB 1TB=1024GB 常量 double :
阅读全文
摘要:auto 局部变量(自动储存)break无条件退出程序最内层循环case switch语句中选择项char单字节整型数据const定义不可更改的常量值continue中断本次循环,并转向下一次循环default switch语句中的默认选择项do 用于构成do.....while循环语句double
阅读全文
摘要:编译:把C语言代码翻译成0和1 工具:编译器 Xcode3 gcc , Xcode4 LLVM (clang) 安装命令行工具 1.指令: cc -c 文件名.c 编译成功,会生成一个.o目标文件 语法错误会报错 2.cc 文件名 链接:其实就是把我们的.o目标文件跟系统自带的函数库合并在一起,生成
阅读全文
摘要:- (void)viewDidLoad { [super viewDidLoad]; int a =5; int b =9; printf("\n%d %d",a,b); tempp(&a, &b); printf("\n%d %d",a,b);}void temp(int a,int b){ pr
阅读全文

浙公网安备 33010602011771号