随笔分类 - C与C++
摘要:函数的结构 #include <stdio.h> // 函数的别称是方法,函数是完成某一特定功能的模块 void print() // 自定义函数 { printf("锄禾日当午 \n"); // printf是系统函数 /* 函数名 printf 函数的参数 "锄禾日当午 \n" () 紧挨着函数
阅读全文
摘要:赋值号左边的叫做左值,赋值号右边的叫右值 左值都在内存中,有内存实体;右值一般在寄存器中,左值也可作为右值 void main024() { int a = 1; //&(a + 2); &取内存地址(&在CPU中完成),而a+2位于寄存器中 a = a + 3; /* a = a + 3; 的计算
阅读全文
摘要:首先说明一下32位和64位系统下的区别: void main001() { int num = 20; int *p = # printf("%p \n", &p); printf("%d \n", sizeof(p)); system("pause"); } /* Name Value T
阅读全文
摘要:0001、选择排序法 1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <time.h> 4 #define N 20 5 6 7 void main() 8 { 9 time_t ts; 10 srand((unsigned int)tim
阅读全文
摘要:001、斐波那契数列 /* 斐波那契数列:f(n)=f(n-1)+f(n-2);其中f(1)=f(2)=1;*/ #include <stdio.h> #include <stdlib.h> /* 斐波那契数列:f(n)=f(n-1)+f(n-2);其中f(1)=f(2)=1; */ int Fib
阅读全文
摘要:C程序编译过程: 1) 预编译:(其本质是将引用的文件已文本文件的方式插入到文件的开始部分) 【1】预处理阶段,凡是预处理指令内容都得进行处理 【2】预处理指令: 以"#"作为开头的命令,常见预处理指令:#define #include #if #endif #progma #include <st
阅读全文
浙公网安备 33010602011771号