Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
文字列から整数を取得できない方法を知りたい
たとえば、ここに私のコードがあります:
int main() { char str[] = "ababbababa-1998"; int nr = atoi(str); printf("%d\n", nr); return (EXIT_SUCCESS); }
実行すると、1998 ではなく 0 が出力されます。どうすれば修正できますか?