A quick question please help

how to save my value m after a for loop..
for example
1
2
3
4
5
int main()
{int m=0;
for(int i=0; i<3 ; i++)
{m=1}
}


i want m to stay 1.. how ?
Last edited on
m IS 1. You set it to 1 three times
when the for loop is done, i dont want m to be destroyed, i want the value of m to stay 1 so i can use it outside the for loop
in other words... why im asking this?
because i want to create an array called password and i have to check that the password is formed out of a combination of numbers and letters together!
I don't see the connection, but ok.
m is not destroyed after the loop. If you defined it like i then it would have been defined inside the loop and destroyed when it ended, but since you defined it outside it will continue to exists
Topic archived. No new replies allowed.