摘要: 标准IO库存在着两个缺陷。首先,它是在某一台特定类型的机器上实现的,而没有考虑其他的具有不同特性的机器。这样就可能导致在其中的一台机器上运行很好的程序,在另外一台机器上却出现错误,而这其中的原因仅仅是因为两台机器的架构不同;第二,设计者发现第一个缺陷之后,试图去修正函数库,如果这样做了,却是的标准IO库失去“标准”的含义。从这方面来讲,C语言缺少可移植性。在开发大型的程序的时候,效率较低。 阅读全文
posted @ 2013-10-24 15:20 平林新袖 阅读(306) 评论(0) 推荐(0) 编辑
摘要: perror()函数的函数原型void perror(char const *message);它会将message信息输出出来,后面再加上错误原因字符串。下面是来自百度百科的实例:#include int main(void){ FILE *fp ; fp = fopen( "/root/noexitfile", "r+" ); if ( NULL == fp ) { perror("/root/noexitfile"); } return 0;} 阅读全文
posted @ 2013-10-24 15:10 平林新袖 阅读(276) 评论(0) 推荐(0) 编辑
摘要: 动态分配内存#include#includeint compare_integers(void const *a,void const *b){ register int const *pa = a; register int const *pb = b; return *pa>*pb ? 1:*pa<*pb ? -1:0;}int main(){ int *array; int n_value; int i; printf("How many values are there?\n"); if(scanf("%d",&n_value 阅读全文
posted @ 2013-10-24 15:03 平林新袖 阅读(348) 评论(0) 推荐(0) 编辑