Problems with memory dynamic allocation: main: malloc.c:3096: sYSMALLOc

大城市里の小女人 提交于 2019-12-06 07:55:36

The problem appears to be at the line where you call malloc().

newPtr is of type mazzo*, but you are allocating space for a carta, which is too small.

I think it should be newPtr=malloc(sizeof(mazzo));

While this may not be an option for you, you would be better off using C++. Among its many software engineering benefits, its new idiom for allocating memory prevents exactly this kind of error, since you must explicitly use the object type: newPtr = new mazzo;

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!