合规国际互联网加速 OSASE为企业客户提供高速稳定SD-WAN国际加速解决方案。 广告
变量建议置于块的开始处,不要总是在第一次使用它们的地方做声明。如 void MyMethod() { int int1 = 0; // beginning of method block if (condition) { int int2 = 0; // beginning of "if" block ... } } 不过也有一个例外 for (int i = 0; i < maxLoops; i++) { ... } 应避免不同层次间的变量重名,如 int count; ... void MyMethod() { if (condition) { int count = 0; // 避免 ... } ... }