Find where i went wrong in my code? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Find where i went wrong in my code?

The code is to rotate the square matrix by 90 degrees clockwise. Iam not getting the desired result. I don't know where i went wrong in my code. Could any please help me? https://code.sololearn.com/cd6shOgrE59N/?ref=app

15th Jan 2019, 5:03 AM
Abhishek Kudlur
3 Answers
+ 1
Okay, it turns out that was the only bug you had, so just look at the top of the code whare the arrays are declared. You need to first scanf for N, then use N to declare both of your arrays. I tested the rotation and it looks good! https://code.sololearn.com/ct36Rt8USAS0/?ref=app
15th Jan 2019, 2:27 PM
Zeke Williams
Zeke Williams - avatar
+ 2
I didn't read past the first line in main. You declare the variable N, but then use it to declare the b array without defining it first. Scanf N before using it to define the b array. I'll read the rest in the morning if someone hasn't helped already :)
15th Jan 2019, 5:43 AM
Zeke Williams
Zeke Williams - avatar
+ 1
Zeke Williams Thank you
16th Jan 2019, 3:23 AM
Abhishek Kudlur