🔢 Digital Decoding Hall
Simulate atoi() — convert string to integer step by step
Load String
Auto Decode
📝 Input String
Current Index
0
Sign
+
State
Ready
Last Digit
-
Accumulated Number
0
Reset
Process Next
🔮 atoi() Algorithm
function
atoi
(s):
// 1. Skip leading whitespace
// 2. Read +/- sign
// 3. Convert digits
result = result *
10
+ digit
// 4. Handle overflow
return
sign * result
⚠️ Integer Limits (32-bit)
INT_MAX = 2,147,483,647
INT_MIN = -2,147,483,648
-42
4193 with words
words and 987
-91283472332
+123