社区
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);
}
...全文
55
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 ...
flutter插件调用APP页面、使用原生aar,framework库
To
resolve
this, run: flutter doctor --android-licenses [✓] Xcode - develop for iOS and macOS (Xcode 12.2) [!] Android Studio (version 4.1) [✓] IntelliJ IDEA Community Edition (version 2020.3) [✓]...
微软内部资料-SQL性能优化2
Before we look at how SQL Server uses and manages its memory, we need to ensure a full understanding of the more common memory related terms. The following definitions will help you understand how SQL...
Using LUA with Visual C++ (Introduction)
Another way to formulate this
que
stio
n : "How can I use LUA in my Visual C++ Project?". The answer is actually pretty easy, you download it from lua.org and you follow the instructions below. Know ...
C语言
69,373
社区成员
243,080
社区内容
发帖
与我相关
我的任务
C语言
C语言相关问题讨论
复制链接
扫一扫
分享
社区描述
C语言相关问题讨论
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章