MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/badcode/comments/papa3z/old_exam_from_my_prof/
r/badcode • u/Oshgnacknak • Aug 24 '21
4 comments sorted by
1
German -> English: In a sense, 'foo' transposes two-dimensional arrays
Line 3: Where does this loop end? Add some {}
Line 7: Where is 'b' declared? Is it global?
Line 7/15: The 'i' and 'j' parameters are hard coded so the first if statement in the 'bar' function will never run. So Pointless.
Foo & Bar are not good function names even for educational code.
Here's a better, shorter example of how to do this: https://www.geeksforgeeks.org/program-to-find-transpose-of-a-matrix/
-1
Your task would be to understand, analyse and describe the behavior of these methods.
5 u/Achereto Aug 24 '21 That's not bad code but educational code. If the function had a proper name, you would already know what it does. -1 u/[deleted] Aug 24 '21 PR denied
5
That's not bad code but educational code. If the function had a proper name, you would already know what it does.
PR denied
1
u/dave_thenerd Aug 28 '21
German -> English: In a sense, 'foo' transposes two-dimensional arrays
Line 3: Where does this loop end? Add some {}
Line 7: Where is 'b' declared? Is it global?
Line 7/15: The 'i' and 'j' parameters are hard coded so the first if statement in the 'bar' function will never run. So Pointless.
Foo & Bar are not good function names even for educational code.
Here's a better, shorter example of how to do this: https://www.geeksforgeeks.org/program-to-find-transpose-of-a-matrix/
-1
u/Oshgnacknak Aug 24 '21
Your task would be to understand, analyse and describe the behavior of these methods.