for和while中的变量

(1)for(int i = 0;i < n;i++)

for中定义的 i  用完后就会释放,不会浪费内存

(2)int y = 10;

   while(y   < 10){

    cout<<y<<endl;

    y--;

    }

其中的y用完后还会在内存中占用内存

原文地址:https://www.cnblogs.com/sxmcACM/p/3452804.html