摘要:
1 #include<iostream> 2 //#include<ostream> 3 //class ostream; 4 class string 5 { 6 public: 7 //constructor 8 string(const char* str=nullptr); 9 //copy 阅读全文
摘要:
使用new/delete申请释放内存 类型名* 指针=new 类型名 int* p=new int; delete p; 类型名* 指针=new 类型名[数组长度] int* ptr=new int[5]; delete []p; 使用malloc/free申请释放内存 类型名* 指针=(类型名*) 阅读全文
摘要:
#:链接字符串,字符串常量需要加“”号;#的右边不能加字符串常量。 ##:粘合参数,不仅仅是字符串,可以是其他类型。 #include<iostream> #define STR(s) "hello"#s#s #define CONS(a,b)(int)(a##e##b) int main() { 阅读全文