[Cexpert-001] How to implement atoi with least codes using C language?
It's soooo easy, I think.
#include <stdio.h>
int atoi(unsigned char *str)
{
int num = 0;
while (*str >= '0' && *str <= '9') num = num * 10 + *str++ - '0';
return num;
}
int main(void)
{
printf("%d\n", atoi("12345"));
return 0;
}
So easy, right?
-
Poechant
-
相關文章
- Leetcode Implement Queue using StacksLeetCode
- how to implement speech recognition in J2EE
- LeetCode-Implement Stack Using QueuesLeetCode
- LeetCode-Implement Queue using StacksLeetCode
- How to Find Out How Much Space an Index is UsingIndex
- LeetCode | 232 Implement Queue Using StacksLeetCode
- Generalizing RDP Codes Using the Combinatorial Method
- How to convert a numeric value or currency to English words using C#C#
- How to get the description of blast hit using blastdbcmd?AST
- How to develop locally a Laravel app using LaragondevLaravelAPPGo
- WPF C# implement scaletransform and translatetransfrom programmaticallyC#ORM
- How To Using Flashback Data Archive (Oracle Total Recall)HiveOracle
- How to Restore the Database Using AMDU after Diskgroup CorruptionRESTDatabase
- How to check whether the current database in using Oracle optionsDatabaseOracle
- [LeetCode] 232. 225 Implement Queue/Stack using Stacks/QueuesLeetCode
- How to Quickly Create a Copy of a Table using Transact-SQLUISQL
- how to run demo city bars using sencha architect
- How to copy a datafile from ASM to a file system not using RMANASM
- How To Export a Concurrent Program and Executable Using Fndload ?Export
- [C練習]my_atoi函式實現函式
- C中atoi和strcpy的自定義實現
- C語言 itoa函式及atoi函式C語言函式
- How to write event log(Event Viewer) using C++ - 用C++如何寫事件日誌(事件檢視器)ViewC++事件
- How to Set Device Name Using UDEV on Oracle Linux 7.1devOracleLinux
- How to serve uncommon file in WebDAV using IIS in Win ServerWebServer
- How To Monitor Remote Windows Machine Using Nagios on LinuxREMWindowsMaciOSLinux
- How to Monitor and Log Network Traffic on Linux Using vnStatLinux
- How To Recreate A Database Using TTS (Transportable TableSpace) [ID 733824.1]DatabaseTTS
- (C language Sample ) Compile procedureCompile
- Leetcode 225. Implement Stack using Queues 用佇列實現棧LeetCode佇列
- LeetCode 225 Implement Stack using Queues(用佇列來實現棧)(*)LeetCode佇列
- [CareerCup] 3.5 Implement Queue using Two Stacks 使用兩個棧來實現佇列佇列
- [CareerCup] 3.1 Implement Three Stacks using Array 使用陣列來實現三個棧陣列
- String to Integer (atoi) 字串轉換整數 (atoi)字串
- 【LeetCode 225_資料結構_棧_實現】Implement Stack using QueuesLeetCode資料結構
- How to See Supplier Contact Information Using SQL in R12ORMSQL
- How to create the Gold gold using RGB color values All In OneGo
- Using MongoDB in C#MongoDBC#