字符串轉換爲整數

一道看似很簡單的題,其實須要考慮不少狀況。 1)需檢測輸入字符串的有效性 2)需跳過字符串前面的空格字符 3)需檢測數字的正負性 4)需判斷數字是否溢出git 代碼以下: int My_atoi(char *str) { assert(str != NULL); int overFlag = 0;web if (str == "") { return 0; } char *inputStr
相關文章
相關標籤/搜索