
C语言
文章平均质量分 60
T1mzhou
这个作者很懒,什么都没留下…
展开
-
C语言解决error expected parentheses around type name in sizeof expression问题
C语言解决error expected parentheses around type name in sizeof expression问题原创 2022-08-27 14:40:38 · 570 阅读 · 1 评论 -
C语言解决网络数据传输缓冲区大小不确定的问题
C语言解决网络数据传输缓冲区大小不确定的问题背景在项目开发中,我们常常遇到这样的状况:网络通信时使用的数据缓冲大小不确定。需要我们动态开辟数据缓冲的空间;解决方案使用GUN C扩展的零长数组尽管零长度数组的大小为零,但由于尾部填充,这种类型的数组成员可能会增加封闭类型的大小。零长度数组成员距封闭结构开头的偏移量与具有一个或多个相同类型元素的数组的偏移量相同。零长度数组的对齐方式与其元素的对齐方式相同。代码实现#include <stdio.h>#include <stdli原创 2021-07-19 23:14:02 · 519 阅读 · 1 评论 -
C语言解决free invalid pointer 导致的core dumped问题引发的思考
C语言解决free invalid pointer 导致的core dumped问题背景在公司的项目中,编译运行后出来free invalid pointer的问题,导致程序运行直接段错误。出现问题的代码片段#include <stdio.h>#include <stdlib.h>#include <string.h>int main() { char * test_data = (char*)malloc(24); if (test_data ==原创 2021-07-13 23:04:58 · 10310 阅读 · 1 评论