Skip to main content

Practice ยท 3 of 4

Fix the Dangling Badge

This program has the classic return-a-local bug. Implement it CORRECTLY: ``c const char *badge_for(int score); ` It must return the string "gold" when score >= 90, "silver" when score >= 80, "bronze"` otherwise. The returned pointer must stay valid for the whole program lifetime โ€” return a string literal (static duration), never a local array.

Difficulty: intermediate

Back to lesson: Practice: Read the Build