使用的atoi用char [英] Using atoi with char
本文介绍了使用的atoi用char的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有一个字符转换成字符串在C的方法吗?
我想这样做是这样的:
的char *数组; 数组[0] ='1'; INT X =的atoi(数组); 的printf(%D,X);
解决方案
如何
改编的char [] =X;
INT X;
改编[0] ='9';
X =的atoi(ARR);
的printf(%D,X);
Is there a way of converting a char into a string in C?
I'm trying to do so like this:
char *array;
array[0] = '1';
int x = atoi(array);
printf("%d",x);
解决方案
How about:
char arr[] = "X";
int x;
arr[0] = '9';
x = atoi(arr);
printf("%d",x);
这篇关于使用的atoi用char的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文