小编Joh*_*eda的帖子

有没有办法编程循环来遍历c​​har*数组中的每个字符?

我想知道是否有一种方法或方法来检查数组中的单个字符

char* s[size] = {
    "0-2324-2324-7", 
    "032121353X", 
    "0-619-66248-X", 
    "0-758-50938-6", 
    "0870495275"
};
Run Code Online (Sandbox Code Playgroud)

我想我必须编写遍历数组中每个条目的for循环和遍历数组内该条目中每个字符的for循环

有点像:

for (int i=0;i<size;i++) 
    for (int j=0; j<"size of s[i]"; j++)  // the size of an entry so "032121353X" would be 10
        int* c= "the j character in s[i]" // assigns c the individual character in s[i]
        if(c<='0'||c>='9')  // checks if its a digit
Run Code Online (Sandbox Code Playgroud)

c c++ arrays

-2
推荐指数
1
解决办法
82
查看次数

标签 统计

arrays ×1

c ×1

c++ ×1