diff --git a/chapters/memory-layout/memory-operations/drills/tasks/pixels/README.md b/chapters/memory-layout/memory-operations/drills/tasks/pixels/README.md index b0427d44..e86744d4 100644 --- a/chapters/memory-layout/memory-operations/drills/tasks/pixels/README.md +++ b/chapters/memory-layout/memory-operations/drills/tasks/pixels/README.md @@ -36,7 +36,7 @@ p.b = 0.11 * p.b; > **Hint:** For simplicity, you can use the following macro: > > ```c -> #define GET_PIXEL(a, i ,j) (*(*(a + i) + j)) +> #define GET_PIXEL(a, i ,j) (*(*((a) + (i)) + (j))) > ``` If you're having difficulties solving this exercise, go through [this](../../../reading/README.md#structures-and-pointers-to-structures) reading material. diff --git a/chapters/memory-layout/memory-operations/drills/tasks/pixels/solution/pixels.c b/chapters/memory-layout/memory-operations/drills/tasks/pixels/solution/pixels.c index 694975df..7db469a7 100644 --- a/chapters/memory-layout/memory-operations/drills/tasks/pixels/solution/pixels.c +++ b/chapters/memory-layout/memory-operations/drills/tasks/pixels/solution/pixels.c @@ -7,7 +7,7 @@ #include #include "pixel.h" -#define GET_PIXEL(a, i, j) (*(*(a + i) + j)) +#define GET_PIXEL(a, i, j) (*(*((a) + (i)) + (j))) void color_to_gray(struct picture *pic) {