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.

Recommended Answers

All 2 Replies

>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.

>>No where in the program they have used X.
But it has -- its used in the macro Y

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.