我正在尝试将几个字符串读入函数进行处理。这些指令将每个字符串传递给函数(不创建2d字符串数组)。参数必须保持不变。这是我试过的将多个字符串传递给函数
#include <stdio.h>
#include <math.h>
void convert(char s[]), int counts[]);
int main(void)
{
int i = 0;
int d[2] = {};
char text0[] = "this IS a String 4 you.";
char text1[] = "This sample has less than 987654321 leTTers.";
while(i<2)
{
convert (text[i],d); """ this is wrong but i dont know how to correctly do this
i = i +1;
}
}
void convert(char s[]), int counts[])
{
printf("%s this should print text1 and text2", s);
}
所以我有几个问题。是否有某种特殊字符/运算符类似于python中的glob模块,它可以正确地为我执行convert (text[i],d)
部分,我尝试在每个字符串中进行读取。此外,int counts[]
的目的是填写功能中的字和字符数。所以,如果我填补了这一阵列在功能convert
将主也认识它,因为我需要打印在main
字/字符计数,而在convert
'text0'和'text [0]'是完全不同的变量。 –
是啊,那就是我卡住了。我想做这样的事情,但我不知道如何 –