#include <iostream>
#include <string>
#include <stdio.h>
using namespace std;
int main()
{
char *s = "asdfggh";
system("cls"); // 清屏
char a[20];
system("pause");
return 0;
}
#include <string>
#include <stdio.h>
using namespace std;
int main()
{
char *s = "asdfggh";
system("cls"); // 清屏
char a[20];
memcpy(a, s, strlen(s)+1); //memcpy(目的串,原串,原串长度)
//strlen函数取值不包括“\ 0”,即此处strlen(s) == 7
printf("%s", a);
//getchar();system("pause");
return 0;
}