

^ =PAkonyl wrote: clearly that guy should just learn to stop using deprecated functions/headers, geez.![]()
Code: Select all
int main()
{
//declarations
int array[10];
//initialization
int i;
for(i=0; i<=10; i++)
{
array[i]=0;
}
return 0;
}
I had also called that to be faulty, but because of the ArrayIndexOutOfBoundsException it generates when i becomes 10...Akonyl wrote: I'm suddenly reminded of all the stupid bugs I've had to fix, this one in particular from a guy I knew
infinite loopedCode: Select all
int main() { //declarations int array[10]; //initialization int i; for(i=0; i<=10; i++) { array[i]=0; } return 0; }
best bug ever
Ah, IC. Still, I don't quite get where the loop comes in -.-Akonyl wrote: it's a C/C++ bug, Java won't do it because it won't let you index out of arrays.
if it was java, it'd be a public static int main() anyway![]()
Code: Select all
void main()
{
//do stuff here
return;
}
You mean like:ranger wrote: wanna know an easy way to know it was C/C++ rather than java?
he/she didn't put "int i" in the for loop, C doesn't let you do that shit
For most compilers before C99 you can't initialize the variable in your for loop for C, you can however in C++Conia wrote:You mean like:ranger wrote: wanna know an easy way to know it was C/C++ rather than java?
he/she didn't put "int i" in the for loop, C doesn't let you do that shit
for (int i=0;i<=10;i++)
{
cout<<i;
}
?
Cause I do that all the time so it is possible![]()
because if you didn't have a loop, how would you have the program loop infinitely?Callid wrote: Ah, IC. Still, I don't quite get where the loop comes in -.-