摘要: /* a1.c */#include<stdio.h>int i; /*定义一个外部变量i */void func();void main(){i=3;printf("%d\n",i);i+=2;func();printf("%d\n",i);}/* a2.c */#include<stdio.h>extern int i; /* 说明i为外部变量 */void func(){printf("%d\n",i);i++; } 阅读全文
posted @ 2012-03-17 23:52 lzihua 阅读(162) 评论(0) 推荐(0) 编辑
摘要: #define MaxLen 50typedef int elemtype;typedef elemtype sqlist[MaxLen];sqlist A;typedef int NUM[100];//声明NUM为整型数组类型NUM n;//定义n为整型数组变量 阅读全文
posted @ 2012-03-17 21:29 lzihua 阅读(140) 评论(0) 推荐(0) 编辑
摘要: const char *name="MIKE";//冻结指针所指向的变量。name为指针,指向MIKE,再被const修饰。char *const name="MIKE";//冻结指针本身。name被const修饰,再char *,为一个指针。const char *const name="MIKE";//同时冻结指针及其所指向的变量。 阅读全文
posted @ 2012-03-17 21:11 lzihua 阅读(153) 评论(0) 推荐(0) 编辑
摘要: //src.cpp:void foo(){ //do something}//main.cpp:#include "src.cpp "int main() { foo(); return 0;}单独编译单个的源文件,不会报错。但是链接时报错。解决办法:先编写src.cpp文件,编写好了,再放到main.cpp文件同级目录。这里涉及到external dependencies文件夹,下回再分析。 阅读全文
posted @ 2012-03-17 20:58 lzihua 阅读(214) 评论(0) 推荐(0) 编辑
摘要: CFree 运行出现abnormal program termination解决办法:卸载,删除注册表HKEY_CURRENT_USER\Software\C-Free重新安装。 阅读全文
posted @ 2012-03-17 20:41 lzihua 阅读(1208) 评论(0) 推荐(0) 编辑
摘要: void main()改为int main() 阅读全文
posted @ 2012-03-17 20:31 lzihua 阅读(617) 评论(0) 推荐(0) 编辑
摘要: 编写完程序加个空行。即代码21行,实际代码20行。 阅读全文
posted @ 2012-03-17 20:28 lzihua 阅读(328) 评论(0) 推荐(0) 编辑