I am attempting to call an array in an order specified by the zigzag construct. Any help and insight into this is greatly appreciated. I have tried several things so I think I can be a little helpful. The project has been a handful. I can't picture how to do that. I was lastly trying to call of the struct and use but it never got picked up in the pattern I needed it to read.
I'm trying to print out the in the order of the coordinates that are in the struct. The current output I get is standard order of the array values. 10,4,2 etc. Other edits I've gotten all 1's or two of each number in standard order.
How do I get the array values to print in the order of the array locations in the struct?
#include <stdio.h>
#include <stdlib.h>
#define N 8
typedef struct _Matrix{
    double element [N][N];
} Matrix;
struct zigzag {
    int row, col;
} ZigZag[N*N] = {
    {0,0},
    {0,1},{1,0},
    {2,0},{1,1},{0,2},
    {0,3},{1,2},{2,1},{3,0},
    {4,0},{3,1},{2,2},{1,3},{0,4},
    {0,5},{1,4},{2,3},{3,2},{4,1},{5,0},
    {6,0},{5,1},{4,2},{3,3},{2,4},{1,5},{0,6},
    {0,7},{1,6},{2,5},{3,4},{4,3},{5,2},{6,1},{7,0},
    {7,1},{6,2},{5,3},{4,4},{4,5},{2,6},{1,7},
    {2,7},{3,6},{4,5},{5,4},{6,3},{7,2},
    {7,3},{6,4},{5,5},{4,6},{3,7},
    {4,7},{5,6},{6,5},{7,4},
    {7,5},{6,6},{5,7},
    {6,7},{7,6},
    {7,7}
};
int data[N*N];
int* ZigZagOrdering(Matrix x) // fill data and return data
{
    int i;
    int j;
    struct zigzag zigzag;
    int k;
    for(i=0; i<N; i++)
    {
        for (j=0; j<N; j++)
        {
            for (k=0; k<N; k++)
            {
                 printf ("%g ",x.element[i][j]);
             }
             printf ("%d " , zigzag.row[k]);
        }// innerfor
        printf("\n");
    }//outer for
}//ZZ 
int main(int argc, char **argv)
{
    // special case that allows us to initialize this way
    Matrix C =    {10,  4, 2,  5, 1, 0, 0, 0,
                    3,  9, 1,  2, 1, 0, 0, 0,
                   -7, -5, 1, -2, -1, 0, 0, 0,
                   -3, -5, 0, -1, 0, 0, 0, 0,
                   -2,  1, 0,  0, 0, 0, 0, 0,
                    0,  0, 0,  0, 0, 0, 0, 0,
                    0,  0, 0,  0, 0, 0, 0, 0,
                    0,  0, 0,  0, 0, 0, 0, 0};
    // encoding
    // EncodeRunlength("output.dat", C);
    //decoding
    // DecodeRunlength("output.dat");
    ZigZagOrdering(C);
}//main
 
     
    