Skip to main content
๐Ÿ› Bug HuntC+ C++ Medium+20 XP

Dangling Reference

This function returns a dangerous reference.

๐Ÿ› Find the bug
1int& getRef() {
2 int x = 42;
3 return x;
4}
๐Ÿ› The bug is on line 3

๐Ÿ”ง Select the correct fix:

Priygop - Leading Professional Development Platform | Expert Courses & Interview Prep