#include <iostream>
using namespace std;
#include<cstddef>
#include<cstring>
#include<string>
int main()
{
int a[] = { 1 ,2, 3 ,4 ,5 ,6 ,7 };
int b[7];
memcpy(b, a, sizeof(a)); //将b复制给a
char st[12] = "fundamental"; //字符的最后一个分隔符‘\0’也算
char str[12];
strcpy_s(str, st);
for (int c : b)
cout << c << '\t';
cout << endl;
for (char d : str)
cout << d << '\t';
}
数组复制、字符串复制、范围for
最新推荐文章于 2021-05-02 22:19:42 发布