2020年3月1日

c 结构体最后一个成员使用长度为0数组

摘要: 变长数组,不用指针,可以只分配一次内存,释放一次内存,方便内存管理 demo.c #include <stdio.h> #include <stdlib.h> #include <string.h> struct demo { char ch1; char ch2; char str[0]; }; 阅读全文

posted @ 2020-03-01 17:58 luckygxf 阅读(516) 评论(0) 推荐(0) 编辑

c gdb demo

摘要: #include <stdio.h> void test_core1() { int i = 0; scanf("%d", i); } void test_core2() { char *name = "guanxianseng"; *name = 0; } int main() { test_co 阅读全文

posted @ 2020-03-01 16:57 luckygxf 阅读(116) 评论(0) 推荐(0) 编辑

c snprintf demo

摘要: 1. snprintf(char *buff, size_t len, char *format, ....),格式化字符串到buff中 #include <pthread.h> #include <stdio.h> #include <unistd.h> int data = 0; int mai 阅读全文

posted @ 2020-03-01 16:09 luckygxf 阅读(127) 评论(0) 推荐(0) 编辑

c 解析so文件

摘要: 1. 生成so文件 https://www.cnblogs.com/luckygxf/p/11894773.html 2. 解析so文件 3. 调用so库函数 // // Created by gxf on 2020/2/27. // #include "hello.h" #include <std 阅读全文

posted @ 2020-03-01 11:55 luckygxf 阅读(808) 评论(0) 推荐(0) 编辑

导航