A
Andrew Joros (ezze16
I have no idea what the problem is...
It is giving me this error: invalid use of array with unspecified
bounds
How can I fix it. Thanks.
#include <stdio.h>
// Prototype
void copy_arr(double a[][], double b[][], int size, int size2);
int main()
{
double source[5][5] = {
{1.1, 1.2, 1.3, 1.4, 1.5},
{2.1, 2.2, 2.3, 2.4, 2.6},
{3.1, 3.2, 3.3, 3.4, 3.5},
{4.1, 4.2, 4.3, 4.4, 4.5},
{5.1, 5.2, 5.3, 5.4, 5.5}
};
double target3[5][5];
int i;
int j;
copy_arr(source, target3, 5, 5);
printf("Array Copy\n");
for (i=0; i < 5; i++)
{
printf("\n");
for (j=0; j < 5; j++)
{
printf("%2.1f ", target3[j]);
}
}
printf("\n\n");
system("pause");
return 0;
}
void copy_arr(double a[][], double b[][], int size, int size2)
{
int i, j;
for (i = 0; i < size; i++)
for (j = 0; j < size2; j++)
**error is here ==> b[j] = a[j]; <== error is here**
}
It is giving me this error: invalid use of array with unspecified
bounds
How can I fix it. Thanks.
#include <stdio.h>
// Prototype
void copy_arr(double a[][], double b[][], int size, int size2);
int main()
{
double source[5][5] = {
{1.1, 1.2, 1.3, 1.4, 1.5},
{2.1, 2.2, 2.3, 2.4, 2.6},
{3.1, 3.2, 3.3, 3.4, 3.5},
{4.1, 4.2, 4.3, 4.4, 4.5},
{5.1, 5.2, 5.3, 5.4, 5.5}
};
double target3[5][5];
int i;
int j;
copy_arr(source, target3, 5, 5);
printf("Array Copy\n");
for (i=0; i < 5; i++)
{
printf("\n");
for (j=0; j < 5; j++)
{
printf("%2.1f ", target3[j]);
}
}
printf("\n\n");
system("pause");
return 0;
}
void copy_arr(double a[][], double b[][], int size, int size2)
{
int i, j;
for (i = 0; i < size; i++)
for (j = 0; j < size2; j++)
**error is here ==> b[j] = a[j]; <== error is here**
}