C言語 整数値の文字列を整数型( int型 )に変換 - stdlib.h - [ atoi ]
2008.10.24 Friday | by LRESULT
数値の文字列 "12345" を整数型( int型 )に変換して表示してみます。 |
---|
#include <stdio.h> #include <stdlib.h> int main(void) { char *s = "12345"; int i; i = atoi( s ); printf( "数値:%d¥n", i ); return 0; } |
数値:12345 |
---|
と、表示されます。 アッサリ行けますね。 |