1 parent 779c534 commit 6e5a500Copy full SHA for 6e5a500
2 files changed
internal/exercises/solutions/17_pointers/pointers.go
@@ -0,0 +1,9 @@
1
+package pointers
2
+
3
+func modifyValue(ptr *int) *int {
4
+ if ptr == nil {
5
+ return nil
6
+ }
7
+ *ptr = 100
8
+ return ptr
9
+}
internal/exercises/templates/17_pointers/pointers.go
@@ -1,10 +1,8 @@
package pointers
-// TODO:
-// - Modify the value pointed to by the incoming *int.
-// - Return the same pointer after updating the underlying value.
-// - Avoid allocating any new memory; operate in place.
-
+// TODO: Modify the value pointed to by the incoming *int.
+// Return the same pointer after updating the underlying value.
+// Avoid allocating any new memory; operate in place.
func modifyValue(ptr *int) *int {
// TODO: implement mutation via pointer
10
return ptr
0 commit comments