Skip to content

fix(pointers): fix compilation of exercise 4.1 - #21

Open
asifwadud wants to merge 1 commit into
rdjondo:mainfrom
asifwadud:fix/unused-variable-pointer-references
Open

fix(pointers): fix compilation of exercise 4.1#21
asifwadud wants to merge 1 commit into
rdjondo:mainfrom
asifwadud:fix/unused-variable-pointer-references

Conversation

@asifwadud

@asifwadud asifwadud commented Jul 20, 2026

Copy link
Copy Markdown

Why

The exercise 4.1 (pointers_references1.cpp) has a compilation error when compiling with -Werror because of an unused variable pointer in the my_pointer_value_swap test case:

pointers_references1.cpp:29:10: error: unused variable ‘pointer’ [-Werror=unused-variable]
   29 |     int *pointer = &val;
      |          ^~~~~~~

This compilation error prevents the user from compiling and running the exercise correctly.

What Changed

Removed the unused variable int* pointer = &val; from the test case loop in pointers_references1.cpp.

Resolves the following warning/error:
pointers_references1.cpp:29:10: error: unused variable ‘pointer’ [-Werror=unused-variable]
   29 |     int *pointer = &val;
      |          ^~~~~~~
cc1plus: all warnings being treated as errors
@asifwadud
asifwadud marked this pull request as ready for review July 20, 2026 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant