機能 |
文字列をint型の表現に変換する。 ※ エラー発生時の動作以外は(int)strtol(nptr, (char**)NULL, 10)と等価 |
||
---|---|---|---|
定義 |
#include <stdlib.h> int atoi ( const char * nptr ); |
||
引数 |
|
||
戻り値 | 変換された値を返す。 | ||
実装例 |
#include <stdlib.h> #include <stdio.h> int main(void) { int n; n = atoi("123.45"); printf("%d\n", n); return 0; } |
||
実行結果 |
123 |
atoi()