Hellow all, im haing a problem ending my for loop inside of a funtcion, if i want the program to cout << m; after a for loop runs how do i get it to print out a store integer?
Printing a variable after for loop completion
Collapse
X
-
Tags: None
-
Yeah, you're a little vague in your problem but i think your problem could be scoping:
Code://Does your current looking something like this for(i = 0; i < 10; i++){ int m = someArray[i]; } std::cout << m; //m won't print it doesn't exist out side of for loop //make it look like this int m = 0; for(i = 0; i < 10; i++){ m = someArray[i]; } std::cout << m;
Comment
Comment