灵异事件——strcpy,帮忙看一下谢谢了
  • 板块学术版
  • 楼主XSean
  • 当前回复2
  • 已保存回复2
  • 发布时间2023/2/2 16:00
  • 上次更新2023/10/24 02:02:55
查看原帖
灵异事件——strcpy,帮忙看一下谢谢了
546830
XSean楼主2023/2/2 16:00
#include <cstdlib>
#include <cstdio>
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
	int num = 10;
	char str1[100] = "123456";
	char str2[1] = {};
	strcpy(str2, str1);
	printf("%s %s", str1, str2);
	for(auto i : str2) cout << " " << i;
	return 0;
}
#include <cstdlib>
#include <cstdio>
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
	int num = 10;
	char str1[100] = "123456";
	char str2[1] = {};
	strcpy(str2, str1);
	printf("%s %s", str1, str2);
	for(auto i : str2) cout << " " << i;
	return 0;
}

输出123456 123456 1

#include <cstdlib>
#include <cstdio>
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
	int num = 10;
	char str1[100] = "123456";
	char str2[1] = {};
	strcpy(str2, str1);
	printf("%s %s", str1, str2);
	//for(auto i : str2) cout << " " << i;
	return 0;
}
#include <cstdlib>
#include <cstdio>
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
	int num = 10;
	char str1[100] = "123456";
	char str2[1] = {};
	strcpy(str2, str1);
	printf("%s %s", str1, str2);
	//for(auto i : str2) cout << " " << i;
	return 0;
}

输出:6 123456

为什么啊

2023/2/2 16:00
加载中...