c語言字元串轉函數
發布時間: 2025-03-24 05:17:03
㈠ c語言atoi用法介紹
函數名: atoi
功 能: 把字元串轉換成長整型數
用 法: #include <stdlib.h>
int atoi(const char *nptr);
程序例:
#include <stdlib.h>
#include <stdio.h>
int main(void)
{
int n;
char *str = "1234";
n = atoi(str);
printf("string = %s integer = %d\n", str, n);
return 0;
}
運行結果是:
string =1234 integer=1234
熱點內容