c語言里面的數(shù)組只能是定長的,想用變長的有兩種方法:
1.char* str = malloc(print);strcpy(str, "this is a string"); //前提是print足夠大2.用c++std::stringstd::string str = "this is a string";
c語言里面的數(shù)組只能是定長的,想用變長的有兩種方法:
1.char* str = malloc(print);strcpy(str, "this is a string"); //前提是print足夠大2.用c++std::stringstd::string str = "this is a string";