动态内存分配给文件操作Strcat不起作用
Strcat不起作用。我正在尝试读取具有动态内存功能的两个文件中的文本。我不明白错误在哪里。 这是我的代码: #include #include void fileTest (char*…
从文件打印字符串时遇到困难
我的任务是从文件中读取单词并分别打印每个单词。 到目前为止,我得到了这个: #define MAX 100000 #include #include #include typedef struct node …
funktion返回后,动态分配的数组的记忆被覆盖
我知道已经有很多有关此主题的帖子,但是我仍然没有发现错误。问题是,在我第一次调用add_record()并返回主函数之后,即使我使用malloc和realloc,…
Valgrind无效写和读取尺寸1和字节丢失
我正在使用内存分配进行拆分功能。然后我通过 valgrind 进行了运行,并遇到了一堆泄漏和丢失的字节。 这是我的功能: char **split(const char *str, …
动态数组int打印问题 - 也许不是有效的内存单元格
#include #include int find_lenght(int *arrr){ int i = 0; while(arrr[i] != '\0'){ i++; } return i; } void init_array(int *arrr){ arrr=(int*)m…
指针分配中的访问违规
我想将随机数据放入 arr (指针分配)中。如何将数据放入该动态分配中? typedef unique_ptr[]> uniquePtr; uniquePtr arr = make_unique[]>(size); s…
valgrind'尺寸的写作无效n&quot使用malloc时
我正在使用此结构创建图形 struct node { int id; struct node *ad; }; struct graph { int numVert; struct node **adjList; int *visited; int *bac…