斗----自尊、自强、自信

蜗牛慢慢爬,只要不停下来就好~~

博客园 首页 新随笔 联系 订阅 管理

随笔分类 -  C/C++

摘要:1.在C++中,为了解决频繁调用小函数大量消耗栈空间或栈内存的问题,引入inline内联函数。 栈空间是有限的,大量频繁使用会造成栈空间的不足。 2.inline修饰符,作用就是要求编译器,付出额外的空间来替换每一次的函数调用。 3.时间减了,空间增加了。 4.与宏的区别:宏是展开,效率也很高。但... 阅读全文
posted @ 2007-12-29 11:50 a斗 阅读(200) 评论(0) 推荐(0)

摘要:原文地址:http://blog.sina.com.cn/s/blog_4a84b9bb0100061l.html 做了小的修改,适用情况是:标点符号在单词后面,最后一个单词后没有空格 #include "stdafx.h" #include #include /****************... 阅读全文
posted @ 2007-12-22 21:54 a斗 阅读(740) 评论(0) 推荐(0)

摘要:虽然见过,但是很少用calloc,还是代码量少啊。。。 区别1:函数形式: void *calloc( size_t num,//numbers of elements size_t size //Length in bytes of each elements ); void *malloc... 阅读全文
posted @ 2007-12-22 16:41 a斗 阅读(985) 评论(0) 推荐(0)

摘要:x&(x-1)==0;反应太慢,笔试的时候想不出来。。 阅读全文
posted @ 2007-12-22 16:01 a斗 阅读(251) 评论(0) 推荐(0)

摘要:Write a program delete itself after execution. 思路:调用cmd命令来删除,用ShellExecute来执行cmd命令 #include #include #include int main(int argc, char* argv[]) { ch... 阅读全文
posted @ 2007-12-22 15:44 a斗 阅读(251) 评论(0) 推荐(0)

摘要:Getmemory的几个经典的关于内存的笔试题还是经常能考到的 void GetMemory1(char *p) { p = (char *)malloc(100); } void Test1(void) { char *str = NULL; GetMemory1(str); strc... 阅读全文
posted @ 2007-12-20 15:21 a斗 阅读(2252) 评论(0) 推荐(0)

摘要:一、自动类型转换 自动转换发生在不同数据类型的变量混合运算时,由编译系统自动完成。自动转换遵循以下各则: 1.若参与运算变量的类型不同,则先转换成同一类型,然后进行运算。 A.char型和short型参与运算时,必须先转换成int型。 B.所有的浮点运算都是以双精度进行的,即使仅含float单精... 阅读全文
posted @ 2007-12-20 14:16 a斗 阅读(627) 评论(0) 推荐(0)

摘要:#include #include #define WORD "test" int main(int argc, char* argv[]) { printf("%d\n",sizeof(WORD)); printf("%d\n",strlen(WORD)); return 0; } //打印出... 阅读全文
posted @ 2007-12-19 11:39 a斗 阅读(118) 评论(0) 推荐(0)

摘要:int abs( int value ); long int labs( long int value ); div_t div( int numerator, int denominator );//返回值是结构体 int quot 商 ;int rem 余数 ldiv_t ldiv(long i... 阅读全文
posted @ 2007-12-17 22:15 a斗 阅读(253) 评论(0) 推荐(0)

摘要:两个相同的结构体可以拷贝,但不能清零: struct AA{ int t; }; struct BB{ int a; char b; int c; struct AA d; }; int main(int argc, char* argv[]) { struct BB xx,yy; ... 阅读全文
posted @ 2007-12-16 10:06 a斗 阅读(523) 评论(0) 推荐(0)