学习C语言数组中遇到的问题,请大佬们帮忙解答,非常感谢

#include

#define ROWS 2
#define COLS 2

void copy_1(int rows, int cols, double * so, double * ta);

int main()
{
int i, j;

double source[ROWS][COLS] = { { 1.1, 2.2 }, { 3.3, 4.4 } };
double target[ROWS][COLS];

for (i = 0; i < ROWS; i++)
{
    for (j = 0; j < COLS; j++)
        printf("%.2ld   ", source[i][j]);

    printf("\n");
}

copy_1(ROWS, COLS, source, target);

for (i = 0; i < ROWS; i++)
{
    for (j = 0; j < COLS; j++)
        printf("%.2ld   ", target[i][j]);

    printf("\n");
}

return 0;

}

void copy_1(int rows, int cols, double * so, double * ta)
{
int r, c;

for (r = 0; r < rows; r++)
{
for (c = 0; c < cols; c++)
((ta + r) + c) = ((so + r) + c);
}
}
//上述代码的功能是将一个二维数组中的数据拷贝到另一个二维数组中,但是出现了错误,错误提示如下:E:\CC++\c file\CODE-C\free2\main.c|43|error: invalid type argument of unary '*' (have 'double')|

#include <stdio.h>

#define ROWS 2
#define COLS 2
void copy_1(int rows, int cols, double * so, double * ta);
int main()
{
    int i, j;
    double source[ROWS][COLS] = { { 1.1, 2.2 }, { 3.3, 4.4 } };
    double target[ROWS][COLS];
    for (i = 0; i < ROWS; i++)
    {
        for (j = 0; j < COLS; j++)
            printf("%.2lf ", source[i][j]);
        printf("\n");
    }
    copy_1(ROWS, COLS, (double *)source, (double *)target);
    for (i = 0; i < ROWS; i++)
    {
        for (j = 0; j < COLS; j++)
            printf("%.2lf ", target[i][j]);
        printf("\n");
    }
    return 0;
}
void copy_1(int rows, int cols, double * so, double * ta)
{
    int r, c;
    for (r = 0; r < rows; r++)
    {
        for (c = 0; c < cols; c++)
            *(ta + r * cols + c) = *(so + r * cols + c);
    }
}

图片说明

如果问题得到解决,请点下采纳

直接贴代码

#include <stdio.h>

#define ROWS 2
#define COLS 2

void copy_1(int rows, int cols, double (*so)[COLS], double (*ta)[COLS]);

int main()
{
    int i, j;

    double source[ROWS][COLS] = { { 1.1, 2.2 }, { 3.3, 4.4 } };
    double target[ROWS][COLS];

    for (i = 0; i < ROWS; i++)
    {
        for (j = 0; j < COLS; j++)
            printf("%.2lf   ", source[i][j]);

        printf("\n");
    }

    copy_1(ROWS, COLS, source, target);

    for (i = 0; i < ROWS; i++)
    {
        for (j = 0; j < COLS; j++)
            printf("%.2lf   ", target[i][j]);

        printf("\n");
    }

    return 0;

}

void copy_1(int rows, int cols, double (*so)[COLS], double (*ta)[COLS])
{
    int r, c;

    for (r = 0; r < rows; r++)
    {
        for (c = 0; c < cols; c++)
            ta[r][c] = so[r][c];
    }
}