社区
C语言
帖子详情
how to resolve the question?
msgsnd
2004-06-10 02:04:57
int *test(){
int *a=NULL;
a=malloc(sizeof(a));
*a=200;
return a;
}
void main(){
int *a=NULL;
int b=0;
a=test();
b=(*a)++;
printf("%d",a);
free(a);
}
...全文
70
2
打赏
收藏
how to resolve the question?
int *test(){ int *a=NULL; a=malloc(sizeof(a)); *a=200; return a; } void main(){ int *a=NULL; int b=0; a=test(); b=(*a)++; printf("%d",a); free(a); }
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
2 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
leonchew
2004-06-10
打赏
举报
回复
//你可能是这个意思吧
#include <stdio.h>
int *test(){
int *a=NULL;
a=(int*)malloc(sizeof(a));//加强制类型转换int*
*a=200;
return a;
}
void main(){
int *a=NULL;
int b=0;
a=test();
b=++(*a);// ++ 在前面,b才能是 *a+1了,否则 结果是200
printf("%d\n",b);//是 b
free(a);
return;
}
结果: 201
junnyfeng
2004-06-10
打赏
举报
回复
有什么问题
PCODA2005proceedings.pdf
and how may be difficult or impossible to
resolve
prior to the build. Moreover, build processes may be rather opa
que
to quality assurance responsible for instrumentation. Instrumenting source code in ...
PCODA2005proceedings.7z.002
and how may be difficult or impossible to
resolve
prior to the build. Moreover, build processes may be rather opa
que
to quality assurance responsible for instrumentation. Instrumenting source code in ...
端口查看工具
CurrPorts uses the DNS cache of Windows to
resolve
remote IP addresses. * Version 1.94: o Added 'Custom' AutoRefresh option under Options -> Auto Refresh. The number of seconds for the Custom ...
外文翻译 stus MVC
The ActionMapping contains the knowledge of how a specific event maps to specific Actions. The ActionServlet (Command) passes the ActionMapping to the Action class via the perform() method. This ...
现代大学英语精读第二版(第六册)学习笔记(原文及全文翻译)——7 - How to Get the Poor off Our Conscience(怎样不为穷人的存在感到内疚)
Unit 7 -How to Get the Poor off Our Conscience How to Get the Poor off Our Conscience John Kenneth Galbraith I would like to reflect on one of the oldest of human exercises, the process by which ...
C语言
70,035
社区成员
243,244
社区内容
发帖
与我相关
我的任务
C语言
C语言相关问题讨论
复制链接
扫一扫
分享
社区描述
C语言相关问题讨论
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章