我的程序无法运行。 我的问题是如何正确定义我的函数原型(prototype)? 另外,函数调用有没有错误? 请帮我!
这是我的代码:
#include <stdio.h>
#include <string.h>
#include <ctype.h>
void copystring(char m[][],char temp[]);
int main()
{
char temp[10000];
char m[10000][10000];
gets(temp);
copystring(m,temp);
printf("%s\n",m[0]);
printf("%s\n",m[1]);
return 0;
}
void copystring(char m[][],char temp[])
{
int i=0;
int j=0;
int k;
for (k=0;k<(strlen(temp));k++)
{
if (temp[k]!=',')
{
m[j][i++]=temp[k];
}
else
{
m[j][i]='\0';
j++;
i=0;
}
}
}
最佳答案
最快的“修复”是这样做:
void copystring(char m[][10000],char temp[]);
但是要小心你的 100MB 数组!!
关于c - 如何正确定义我的函数原型(prototype)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20679279/