Nagy Robi Nagy Robi - 1 year ago 112
C++ Question

Array declaration inside struct using predefined constant in C++

I want to declare an array inside a structure with a predefined constant size, but it gives me this error : expected a ']'.

#define MAX_SZAMJEGY 200;

struct szam {

int szj[MAX_SZAMJEGY];
bool negative;

Answer Source

Macro expands to

int szj[200;]; 

which is not valid C++ code.

remove ; from #define MAX_SZAMJEGY 200;

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download