code:

Stu* pStu = malloc(sizeof(Stu));

改为
Stu* pStu = (Stu*)malloc(sizeof(Stu));

code

#include <stdio.h>
#include <stdlib.h> typedef struct {
int a;
int b;
}Stu; Stu* getStu(int x, int y)
{
Stu* pStu = (Stu*)malloc(sizeof(Stu));
pStu->a = x;
pStu->b = y;
return pStu;
} int main()
{
int x = , y = ;
Stu *pStu = getStu(x, y);
printf("%d %d\n", pStu->a, pStu->b);
free(pStu);
return ;
}

输出

Program ended with exit code: 

https://blog.csdn.net/weixin_34221332/article/details/86981433

最新文章

  1. MVC 框架搭建
  2. EXTJS 动态改变Gird 列值
  3. Java 7 的7个新特性
  4. elasticsearch2.2 集群搭建各种坑
  5. NSRangeFromString 测试
  6. Selenium如何使用自定义的Firefox配置文件?
  7. Sourcetree add Submodule
  8. HTML5之 WebWorkers
  9. Log4Net 使用总结
  10. 一个磁盘I/O故障导致的AlwaysOn FailOver 过程梳理和分析
  11. sql 中 and 和 or的坑
  12. (12)SecureCRT中文乱码问题
  13. Kubernetes节点维护
  14. 整型 布尔值 字符串 for循环
  15. python自动化测试入门篇-postman
  16. 转&quot;container of()函数简介&quot;链接地址
  17. HDU 1014 G题
  18. 【整理】Git相关资料
  19. jQuery.event详细解析
  20. CNN细节

热门文章

  1. Spring Cloud Alibaba学习笔记(13) - Spring Cloud Stream的监控与异常处理
  2. RuntimeError: Model class users.models.UserProfile doesn&#39;t declare an explicit app_label and isn&#39;t in an application in INSTALLED_APPS.
  3. VC 中的ATL ActiveX 和 MFC ActiveX 有什么区别
  4. Eva 剧情解析
  5. MP4数据封装格式
  6. JSONObject和URL以及HttpURLConnection的使用
  7. arm的基本介绍
  8. flask之蓝图BulePrint使用
  9. Mysql之表的查询
  10. [dev][ipsec][distributed] strongswan如何做热迁移/高可用/High Availability