Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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 :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading