c++中字符串数组转化成int型数组

[复制链接]
查看11 | 回复2 | 2017-9-8 10:07:37 | 显示全部楼层 |阅读模式
字符串数组,里面需要存储的是合法的整型变量的形式,如“1234”这样的,才有可能转换为int型数组。转换时,可以使用sscanf函数来实现。代码如下:void convert_string_to_int(string *s, int *a, int len){
int i;
for(i = 0; i #include #define SIZE 3void getResult(int d[],char* list[],int length){ int i=0; while(i<length){d=atoi(list);i++; }}void ...
回复

使用道具 举报

千问 | 2017-9-8 10:07:37 | 显示全部楼层
简单char s[] = "123";int n = atoi(s);接下来你知道了...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行