0

Header file which contains follwing code please help me


#define X {{1,1,2,3,4,5,66},{3,2,4,1,5,0}}
X was used as a member to another Macro


#define Y {X,F,I} like this F and I also defined in the same format as X


My question is how to acess these elements because No where in the program they have used X.

3
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by Ancient Dragon
0

>My question is how to acess these elements
Looks like an obtuse way to intialize a multidimensional array:

#include <stdio.h>

#define X {{1,1,2,3,4,5,66},{3,2,4,1,5,0}}
#define F {{1,2,3,4,5,6,7},{1,2,3,4,5,6}}
#define I {{5,6,7,5,4,3,2},{0,9,8,7,6,5}}
#define Y {X,F,I}

int main ( void )
{
  int a[3][2][7] = Y;
  int i, j, m;

  for ( i = 0; i < 3; i++ ) {
    for ( j = 0; j < 2; j++ ) {
      for ( m = 0; m < 7; m++ )
          printf ( "%d ", a[i][j][m] );
      printf ( "\t" );
    }

    printf ( "\n" );
  }

  return 0;
}

>No where in the program they have used X.
Then you can remove it.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.