linux下將整數轉化爲字符串用法(itoa()函數,sprintf()函數)

1.1在linux系統下,沒有itoa()函數,只有atoi()函數。其中itoa()函數的頭文件如下: #include <stdlib.h> 1.2想要實現將整數轉化爲字符串,可以用如下函數實現。 sprintf(str, "%d", rand());//將整形變量轉換爲字符串變量    rand()表示隨機數,0-42億範圍內 1.3程序調用運行後的結果圖,如下圖所示: 參考內容: http
相關文章
相關標籤/搜索