on slide 61 of lesson 2 (sub-theme Pointers), an example C code snippet is presented to illustrate pointer behavior, specifically returning the address of a local variable
int* get_pointer(void) {
int i = 42;
return &i;
}
the slide then juxtaposes this with a Go equivalent, implying similar behavior or direct analogy:
func getPointer() *int {
var i int = 42
return &i
}
the C code example for get_pointer() that returns the address of a stack-allocated variable int i immediately leads to Undefined Behavior upon dereferencing the returned pointer in main printf("%d\n", *p);