![]() |
||
|
Advance Member
![]() ![]() 加入日期: Jul 2001
文章: 447
|
C語言的char要怎麼轉int?
請問一下唷…在其他語言…都有函式能將字串轉數值(當然啦…輸入的一定是數字)
C要怎麼轉啊?
__________________
@~~@ 網路的發展出現了兩種討厭的人 第一、懂裝不懂 第二、不懂裝懂 |
|||||||
|
|
|
Amateur Member
![]() 加入日期: Nov 2003 您的住址: taichung
文章: 31
|
試試看 atoi() function.
必須包含 stdlib.h header file for example, #include <iostream.h> #include <stdlib.h> int main() { char a = 'A'; int b = atoi(a); printf(b); return 0; } |
||
|
|
|
Major Member
![]() 加入日期: Sep 2004
文章: 124
|
應該能使用 atoi() 吧
如:atoi( string ); 印象中是定義在<stdlib.h>這個標頭檔裡 |
|
|