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