トップページ > キーワード検索 > atoi()
C言語規格
C言語(その他)
プログラム
その他
atoi()
機能 文字列をint型の表現に変換する。
※ エラー発生時の動作以外は(int)strtol(nptr, (char**)NULL, 10)と等価
定義 #include <stdlib.h>

int atoi ( const char * nptr );
引数
nptr変換する文字列
戻り値 変換された値を返す。
実装例
#include <stdlib.h>
#include <stdio.h>

int main(void)
{
    int n;
    
    n = atoi("123.45");
    
    printf("%d\n", n);
    
    return 0;
}
実行結果
123





inserted by FC2 system