小编ste*_*eve的帖子

你必须在C中声明函数吗?

可能的重复:
必须在 C 中声明函数原型吗?

我正在学习 C,在我正在阅读的这本书中,这段代码有一个声明void scalarMultiply(int nRows, int nCols, int matrix[nRows][nCols], int scalar);. 即使我不包括这一行,该程序似乎也能工作?

    int main(void)
    {

        void scalarMultiply(int nRows, int nCols, int matrix[nRows][nCols], int scalar);
        void displayMatrix(int nRows, int nCols, int matrix[nRows][nCols]);
    int sampleMatrix[3][5] = {
        { 7, 16, 55, 13, 12},
        { 12, 10, 52, 0, 7 },
        { -2, 1, 2, 4, 9   }

    };

    scalarMultiply(3, 5, sampleMatrix, 2);


}    void scalarMultiply(int nRows, int nCols, int matrix[nRows][nCols], int scalar){
        int row, column;

        for (row …
Run Code Online (Sandbox Code Playgroud)

c

5
推荐指数
2
解决办法
4069
查看次数

标签 统计

c ×1