摘要: 延时有非精确延时和精确延时。 非精确延时: for(i=0;i<1000;i++); i=1000; while(i--); 精确延时: 库函数:-nop-(); //要引用头文件 #include <intrins.h> 用定时器,代码如下: #include <reg52.h>sbit LED= 阅读全文
posted @ 2017-08-28 13:56 梦里梦见梦不见的 阅读(245) 评论(0) 推荐(0) 编辑
摘要: #include <reg52.h> sbit LED=P0^0;//sbit 小写 ,P必须大写 void main() { LED=0; while(1);//程序停止在这里 // while(1) //无限循环 // { // LED=0; // //} } 一般来说这样就可以点亮小灯了,但是 阅读全文
posted @ 2017-08-26 13:46 梦里梦见梦不见的 阅读(210) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h>int convert(char *str){ int k=0; while(*str!='\0') { k=k*10+(*str++)-'0'; } return k; } int main(int argc, const char * argv[]) { ch 阅读全文
posted @ 2017-07-12 09:04 梦里梦见梦不见的 阅读(313) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h> #define W 50 struct Students{ char name[20]; int sno; float yu; float shu; float ying; }stus[W]={{"zhao",0,20,99,97}, {"zhao1",1,97 阅读全文
posted @ 2017-07-10 14:01 梦里梦见梦不见的 阅读(150) 评论(0) 推荐(0) 编辑
摘要: 共用体 内存大小就是其中数据类型内存最大的内存大小。 #include <stdio.h> int main(int argc, const char * argv[]) { union uu { int a; double b; char c; }pp; printf("%d",sizeof(pp 阅读全文
posted @ 2017-07-06 11:33 梦里梦见梦不见的 阅读(82) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h> int main(int argc, const char * argv[]) { struct per1 { int a; double b; char b2; int a1; char b3; }per3; struct per1 *p; p=&per3; 阅读全文
posted @ 2017-07-06 11:26 梦里梦见梦不见的 阅读(111) 评论(0) 推荐(0) 编辑
摘要: 这只是作者自己的理解,读者看不明白请找其他资料。 #include <stdio.h> int main(int argc, const char * argv[]) { struct per { int a; double b; //内存大小:16 int a1; 8个内存地址前四个 char b 阅读全文
posted @ 2017-07-06 11:13 梦里梦见梦不见的 阅读(122) 评论(0) 推荐(0) 编辑
摘要: 函数指针:实质是指针 int (*zz) 有括号 指针函数:实质是函数 int *zz 无括号 返回值是地址 函数指针: int (*zz)();int wang(int a,int b){ return a+b;} int main(int argc, const char * argv[]) { 阅读全文
posted @ 2017-07-04 14:41 梦里梦见梦不见的 阅读(154) 评论(0) 推荐(0) 编辑
摘要: 递归函数 : 函数调用本身。 列: 5的阶乘 :——》120 int mm(int a) { if (a<=1) { return a; } else { return mm(a-1)*a; } } int main(int argc, const char * argv[]) { int a=mm 阅读全文
posted @ 2017-07-03 12:08 梦里梦见梦不见的 阅读(187) 评论(0) 推荐(0) 编辑
摘要: int *p; p = NULL; int a; if (p != NULL) { *p = 100; } printf("%d",a); 空指针的作用:避免出现野指针。 阅读全文
posted @ 2017-06-28 16:21 梦里梦见梦不见的 阅读(113) 评论(0) 推荐(0) 编辑