c - 如何正确定义我的函数原型(prototype)?

标签 c function prototype

我的程序无法运行。 我的问题是如何正确定义我的函数原型(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/

相关文章:

javascript - 为什么 'abc' .hasOwnProperty ('length' ) == true

JavaScript:复制对象键值而不更改引用的对象键

c - 还有其他方法可以处理许多 'malloc' 故障吗?

C++:在这种情况下引用的优势是什么?

C++函数指针[树莓派]

postgresql - 如何在 postgresql 函数中使用变量进行循环查询

c - 程序的时间复杂度

c - 奇怪的 Klockwork 发现(缓冲区溢出)

ios - 如何使用自己的图片制作圆形进度表?

javascript - 在 Javascript 中如何制作具有可实例化的自定义行为的数组?