循环体里的局部变量的生命周期

在循环体定义的局部变量每次循环都经历一次申请、释放。

for(int c = 0;c < 10; c++)

{

  int a = 10;

}

while()

{

  int b = 10;

}

其中 a、b 每次循环都经历一次申请、释放;

c 只经历一次。

原文地址:https://www.cnblogs.com/wxl309729255/p/5876031.html