Hello everyone! Here I have a code that rotates the square matrix clokcwise and I am trying to do that I can rotate it k times (k is inputed by the user). I tried to use three loops, first: looping till i value reaches k and inside that the second and the third: looping through the matrix itself, but that did not work, so here below is only the rotating algorithm and maybe anyone can give me a hint on how to implement what I want?
You could very carefully rotate the matrix without losing any data, using a different method than simple loops.
But since RAM is like 5 or 10 bugs a gigabyte these days, maybe you should just define two arrays and copy one into the other when you rotate it. Just saying..