Say, I have the following struct in C#:
public struct MyStructCSharp
{
private byte[] offsets = new byte[] { 28, 20, 27, 36 };
}
How do you do the same in C/C++?
The following doesn’t seem to work:
typedef struct _MyStructCpp
{
_MyStructCpp()
{
offsets[] = {28, 20, 27, 36};
}
private:
unsigned char offsets[];
}MyStructCpp;
You cannot assign to an array after it has been declared. Aside from that, the syntax would be wrong. If it only ever has 4 elements then do this or just use a
vectorif you can.Also, do not begin your type names with an underscore. These are reserved and it could lead to nastiness.