会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
Epirus
新随笔
管理
上一页
1
···
16
17
18
19
20
21
22
23
24
···
37
下一页
2012年10月4日
C calloc malloc realloc
摘要: 三者的区别 malloc --->分配内存 calloc ---->分配内存初始化为0 realloc---->重新调整已经分配好的内存
阅读全文
posted @ 2012-10-04 13:10 Epirus
阅读(128)
评论(0)
推荐(0)
2012年9月29日
C 数组名称的意义
摘要: #include <stdio.h>#include <stdlib.h>void foo(char c[10]){ c++; c[0]='a';}main(){ char s[10]={'1','2','3','4'}; foo(s); printf("%s",s);}输出的结果是:1a34从上面的代码中我们可以发现你可以对c指针进行操作,但是你是无法在main函数中对s进行操作,其实这个也很好理解,如果你在main中使用了s++那么数据将会丢失,有可能无法找回原先的地
阅读全文
posted @ 2012-09-29 14:39 Epirus
阅读(212)
评论(0)
推荐(0)
2012年9月28日
C 数据类型字节数
摘要: 今天考试,然后碰到一个数据类型的问题,气死我了。int --->4Bunsigned int ->4Bunsigned short ->2Blong a->8Bunsigned short a->2Bshort a->2Bunsigned long a->8Blong long a->4B
阅读全文
posted @ 2012-09-28 14:51 Epirus
阅读(145)
评论(0)
推荐(0)
C 递归问题的解法
摘要: 今天考试碰到一个问题,其实,我们一般所执行函数时,只要这个函数中不含局部全局变量,那么这个函数就是安全的。所以我们在递归分析的时候,先分析最外面一层跟,分析最里面一层没有什么区别,right?#include <stdio.h>#include <stdlib.h>void e(int n){ if(n>0){ e(--n); printf("%d",n); e(--n); }}int main(){ int a; a=3; e(a);}result=0120
阅读全文
posted @ 2012-09-28 14:14 Epirus
阅读(168)
评论(0)
推荐(0)
C 局部全局变量
摘要: 今天有个考试,非常有意思,就是局部全局变量#include <stdio.h>#include <stdlib.h>int counter(int i){static int count=0;count=count+i;return (count);}int main(){ int i,j; for(i=0;i<=5;i++) j=counter(i); printf("%d",j);}其实这个问题可以这么理解,假如每次count都置0,那么局部的全局变量还有什么意义呢,所以static int count只会执行一次。所以count不会每次都
阅读全文
posted @ 2012-09-28 13:56 Epirus
阅读(130)
评论(0)
推荐(0)
上一页
1
···
16
17
18
19
20
21
22
23
24
···
37
下一页
公告