XINU
atoi.c
Go to the documentation of this file.
1 
19 int atoi(char *p)
20 {
21  int n = 0, f = 0;
22 
23  for (;; p++)
24  {
25  switch (*p)
26  {
27  case ' ':
28  case '\t':
29  continue;
30  case '-':
31  f++;
32  case '+':
33  p++;
34  }
35  break;
36  }
37 
38  while (*p >= '0' && *p <= '9')
39  {
40  n = n * 10 + *p++ - '0';
41  }
42 
43  return (f ? -n : n);
44 }
int atoi(char *p)
ASCII文字列をint型に変換する。
Definition: atoi.c:19