How to convert c++ to c#?

I not understand what’s mean unsigned char field[1];

#define FLGX (224)  

struct game {
    unsigned char field_width;
    unsigned char field_height;
    unsigned char field[1]; 
};                       
  
#define GETPOS(g,x,y) (g->field[(g->field_width + 2) * ((y)+1) + ((x)+1)] & (0xff ^ FLGX))

>Solution :

Trying to translate languages line by line is a bad idea. Conceptually this struct just holds a width and height along with a char array of size width * height. The GETPOS macro indexes into that char array and masks off some bits used for bookkeeping. In C# you can just have a char[].

Leave a Reply