pastebin
| #1 paste tool since 2002
create new paste
tools
api
archive
real-time
faq
pastebin
Follow @pastebin
create new paste
trending pastes
sign up
login
my settings
my profile
My Pastes
Public Pastes
Untitled
1 sec ago
Untitled
5 sec ago
Untitled
8 sec ago
Untitled
12 sec ago
Untitled
14 sec ago
Untitled
18 sec ago
Untitled
21 sec ago
Untitled
21 sec ago
Layout Width
Share Pastebin
Untitled
By: a guest | Mar 22nd, 2010 | Syntax:
C
| Size: 0.16 KB | Hits: 88 | Expires: Never
Download
|
Raw
|
Embed
|
Report abuse
This paste has a previous version,
view the difference
.
/* atoi: convert s to integer */
int
atoi
(
char
s
[
]
)
{
int
i
,
n
;
n
=
0
;
for
(
i
=
0
;
s
[
i
]
>=
'0'
&&
s
[
i
]
<=
'9'
;
++
i
)
n
=
10
*
n
+
(
s
[
i
]
-
'0'
)
;
return
n
;
}
create new paste
|
create new version of this paste
RAW Paste Data
/* atoi: convert s to integer */ int atoi(char s[]) { int i, n; n = 0; for (i = 0; s[i] >= '0' && s[i] <= '9'; ++i) n = 10 * n + (s[i] - '0'); return n; }