#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>
#define LEN1 4294967295
#define LEN2 1024
void strcopy(char *f, char *t);
char *from;
char *to;
int main(int argc, char *argv[])
{
int i = 0;
char *arr[1024];
while (1) {
char *x = (char *)malloc(LEN1 * sizeof(char));
char *x1 = (char *)malloc(LEN1 * sizeof(char));
char *x2 = (char *)malloc(LEN1 * sizeof(char));
char *x3 = (char *)malloc(LEN1 * sizeof(char));
char *x4 = (char *)malloc(LEN1 * sizeof(char));
char *x5 = (char *)malloc(LEN1 * sizeof(char));
printf("%d\n", ++i);
}
scanf("%s", from);
strcopy(from, to);
return 0;
}
void strcopy(char *f, char *t)
{
while (*t++ = *f++) {
;
}
}问题,值得研究 申请内存不释放没有问题
C语言内存分配与字符串复制
最新推荐文章于 2024-08-21 22:18:43 发布
本文探讨了C语言中动态内存分配的方法及其潜在风险,并实现了一个简单的字符串复制函数。通过对内存分配的理解和实践,展示了如何使用malloc进行内存分配及字符串复制的过程。
1万+

被折叠的 条评论
为什么被折叠?



