转载:const放在函数前后的区别 一.const修饰指针 int b = 500; 1.const int * a = & b; 2.int const * a = & b; 3.int * const a = & b; 4.const int * const a = & b; 对于1和2 const 放在*左侧,就是用来修饰指针所指向的变量,即指针指向的是常量. 若a是仓库管理员,b是仓库.即仓库中的货物(*a)不允许改变.但是可修改指针指向或b的值来改变*a. 对于3…
关于 string和StringBuilder的区别参考MSDN.本文用程序演示它们在内存中的区别,及其因此其行为不同. //Demo string memory model namespace ConsoleApplication2{ class Program { static void Main(string[] args) { string a = "1234"; string b = a;//a,and b point to the…