Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/ShivaBhattacharjee/KeyZen
/ safe_divide
Function
safe_divide
data/cpp/06_error_handling.cpp:17–22 ·
view source on GitHub ↗
Source
from the content-addressed store, hash-verified
15
}
16
17
int safe_divide(int a, int b) {
18
if (b == 0) {
19
throw std::invalid_argument(
"division by zero"
);
20
}
21
return a / b;
22
}
23
24
int main() {
25
try {
Callers
1
main
Function · 0.70
Calls
no outgoing calls
Tested by
no test coverage detected