Relative Content

Tag Archive for crefactoring

How can I refactor similar functions to avoid code duplication in C?

I’m working on a Tetris-like game in C and I have two functions, check_left_side_occupation and check_right_side_occupation, which are very similar. I want to refactor them to avoid code duplication, but I’m not sure how to achieve that. Here is the relevant part of my code: