use postfix and variable initialisation

This commit is contained in:
kdx
2023-06-18 16:15:44 +02:00
parent 54523b29c0
commit 29c3992343
12 changed files with 34 additions and 44 deletions

View File

@ -1,23 +1,21 @@
atoi(str)
{
local i;
local sign;
local out;
out = 0;
sign = 0;
i = 0;
local i = 0;
local sign = 0;
local out = 0;
loop {
if ([str + i] == '-')
sign = sign == 0;
else if ([str + i] != '+')
break;
i = i + 1;
i++;
}
loop {
if ([str + i] == 0 | isdigit([str + i]) == 0)
break;
out = out * 10 + [str + i] - '0';
i = i + 1;
i++;
}
if (sign)
return (0 - out);