64,682
社区成员
发帖
与我相关
我的任务
分享
#include<iostream>
using namespace std ;
#define ARRAY 100
int main()
{
int i(0) ;
char *s = new char[ARRAY] ;
for (i = 0 ; i < ARRAY ; ++i)
s[i] = '\0' ;
s = "just for a try !" ;
cout <<strlen(s) <<endl ;
cout <<s <<endl ;
delete []s ;
return 0 ;
}
char *s = new char[ARRAY] ;
for (i = 0 ; i < ARRAY ; ++i)
s[i] = '\0' ;
strcpy (s,"just for a try !");
cout <<strlen(s) <<endl ;
cout <<s <<endl ;
delete[] s;