65,211
社区成员
发帖
与我相关
我的任务
分享
#include "stdafx.h"
#include <iostream.h>
#include <string.h>
int main(int argc, char* argv[])
{
char *mep=new char[20];
int a=0;
memset(mep,0,20); //要初始化
strcpy(mep,"hello"); //用strcpy
//或者
//memcpy(mep,"hello", 1 + strlen("hello"));
cout < <strlen(mep) < <endl;
return 0;
}