Skip to main content

Practice ยท 3 of 4

Fix: Missing Return Path

sign_of(int x) falls off the end for x > 0 โ€” undefined behavior. Fix it so it returns -1, 0, or 1 for negative, zero, and positive. ``c int sign_of(int x) { if (x < 0) return -1; if (x == 0) return 0; } ``

Difficulty: beginner

Back to lesson: Practice: Warning Forensics