Bill Cunningham billcun@suddenlink.net [c-prog]
2018-11-03 20:23:08 UTC
I have looked everywhere I know to look and can't get an answer on this
one. Here's the only code I know to try. Probably with bugs.
#include <stdio.h>
int main()
{
   char a[3][3] = { {}, {3, 2, 1} };
   int i, j;
   char b[3][3] = { {}, {} };
   for (i = 0; i < 3; i++)
       for (j = 0; j < 3; j++)
           b[j][j] = a[i][i];
}
I have a 2 dimensional array.First 3 element values not set. Second
initialize to 3,2, and 1. Can you copy one array value in a two
dimensional array to the other array? For example,
int a[3][3]; copy elements from the second array to the first that is
empty. Or has garbage values. There is memmove but I thought I might be
able to do this the manual way. Would I need to use another 2
dimensional array to do this?
Bill
one. Here's the only code I know to try. Probably with bugs.
#include <stdio.h>
int main()
{
   char a[3][3] = { {}, {3, 2, 1} };
   int i, j;
   char b[3][3] = { {}, {} };
   for (i = 0; i < 3; i++)
       for (j = 0; j < 3; j++)
           b[j][j] = a[i][i];
}
I have a 2 dimensional array.First 3 element values not set. Second
initialize to 3,2, and 1. Can you copy one array value in a two
dimensional array to the other array? For example,
int a[3][3]; copy elements from the second array to the first that is
empty. Or has garbage values. There is memmove but I thought I might be
able to do this the manual way. Would I need to use another 2
dimensional array to do this?
Bill