import core.stdc.stdio;
import core.stdc.string;
extern(C):
int main ()
{
int v= 10;int *p;
printf("hh:%p", p);//
p= &v;
printf("hh:%p,%d\n", p,*p);
enum string s1="akb",s2 = "haha";
enum string s11=s1~s2;//bianyishi
char[]s4,s3,s6;char*s5,s7;
s3=cast(char[])s1;s4=cast(char[])s2;
printf("s3: %s\n", s1.ptr);
s5=strcat(s3.ptr,s4.ptr);
printf("%s,%s\n", s4.ptr,s5);
printf("(s1) : %d\n", s1.length);
//s7=strchr(s5,7);
s7=strdup(s5);//fuzhi dizhi
//s7=strcpy(s5);//fuzhi dizhi
printf("(s6):%p,%s\n", s7,s11.ptr);
return 0;
}
有串
的话,用枚
:
import core.stdc.stdio;
extern(C):
void main()
{
string m="fool!";//如果有串的计算,用`枚`.
printf("%s\n", m.ptr);
}