I'm writing a program that does image manipulation. I have a block of code that looks like this:
basically, my cout statement outputs the correct values, so grid1 stores the values correctly at that point.
Once I'm outside of the for loops though, my grid1 doesn't have any values! It's all zero's! it's like it's been reset to what it was before the nested for loops.
I just don't get it. It's probably some stupid reason that I'm just too tired to see. what is causing this, and how do i fix it?
haha oh and don't hate me for my same-line braces
Code:
int i,j;
int rowCount,colCount=0;
for(i=h0;i<h1;i++) {
colCount = 0;
for(j=v0;j<v1;j++) {
grid1[rowCount][colCount] = pixelValue[i][j];
cout << "value: " << grid1[rowCount][colCount] <<endl;
colCount++;
}
rowCount++;
}
basically, my cout statement outputs the correct values, so grid1 stores the values correctly at that point.
Once I'm outside of the for loops though, my grid1 doesn't have any values! It's all zero's! it's like it's been reset to what it was before the nested for loops.
I just don't get it. It's probably some stupid reason that I'm just too tired to see. what is causing this, and how do i fix it?
haha oh and don't hate me for my same-line braces