Brok Posted July 28, 2015 Posted July 28, 2015 I have something like: for(j=0; j<columnsNumber; j++) { for(i=0; i<rowsNumber; i++) { bufferMatix[j][i] = sourceMatrix[i][j]; } But it works only when rowsNumber=colsNumber Thanks! Quote
Josh Posted July 29, 2015 Posted July 29, 2015 I think that will cause problems because you are copying things that were previously copied. You will need a temporary buffer. Quote Let's build cool stuff and have fun.
Andrr Posted July 29, 2015 Posted July 29, 2015 You can just swap matrix elements is memory like it's demonstrated here. 1 Quote
Josh Posted July 29, 2015 Posted July 29, 2015 You still have a temporary variable, you're just using a lot of them in a function instead of one big buffer. Just for fun, there IS a way to switch to variables without declaring a third. int a = 3; int b = 7; a += b; b = a - b; a -= b; I don't recommend doing that because you could create a number that exceeds the range of your data type. 2 Quote Let's build cool stuff and have fun.
Brok Posted July 29, 2015 Author Posted July 29, 2015 Andrr, Josh Thank you! You're realy help me! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.