NEVERMIND, FIXED IT. for loop issue
I'm trying to do some number crunching with formatted output, and I've run into a problem with half my output not printing. I've written a small test code to illustrate the problem:
#include <iostream>
int testF(){
for (int i; i<10; i++) {
std::cout << i << "\n";
}
return 0;
}
int main(){
std::cout << "START_(this_line_seems_to_be_causing_problems)\n";
int sret = 1;
sret = testF();
std::cout << sret << "\n";
std::cout << "END\n";
return 0;
}
The problem seems to hinge on the line std::cout << "START_(this_line_seems..."
.
If I comment out this line, it will print the contents of testF()
. If I don't then testF()
does not print, although it does give a return value.
It's important that I can print from both main
and my functions. Is there a way I can do both?