Ranter
Join devRant
Do all the things like
				++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
				Sign Up
			Pipeless API
 
				From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
				Learn More
			Comments
		- 
				
				I can't really see anything without looking at the arrays you are indexing through.
 
 I am guessing that cols and rows are reversed?
- 
				
				 Xenotoad509y@deusprogrammer Xenotoad509y@deusprogrammer
 x doesn't get reset after the first iteration of the outer loop, so it stays equal to cols and the inner for loop's test fails every time.
- 
				
				@deusprogrammer that's why I rant at people who depend on heavy, formal code review to prevent defects. 😂
- 
				
				@siksniraps On the question why one would declare the variable outside of the for loop, some C compilers will complain if you don't declare it before the for statement. But as to why I didn't set it in the for loop... Who knows, sometimes we're just stupid, aren't we?
- 
				
				@yamatoman I'd love to have someone like you review my code at my 05:30 busride when my spare 20 minutes of personal coding takes place 😁





The feeling when you didn't spot what the error was here:
int x = 0;
int y = 0;
for ( ; y < rows; y++) {
for ( ; x < cols; x++) {
//Dafuq, only does one line?!
}
}
undefined
don't code tired
pretty simple