Warning: array elements over 100

I have a piece of code declaring an array.

#define MAX_ELEMENT 150
Struct_arr  arr_elem[MAX_ELEMENT];

Here Struct_arris the structure. When compiling, I get a warning for this later line as:

warning: array elements are more than 100

Can someone please help me about this?

Regards, vivG

+3
source share
2 answers

This is almost certainly the result of a directive #warningin code. C ++ itself does not limit you to 99 elements of the array, it will be an artificial limit introduced for some reason.

My advice would be to find this post and see if there are any comments that can help explain why this is a problem. Sort of:

fgrep 'array has more than' *.c *.cpp *.h *.hpp

since a UNIX-like operating system would be a good starting point.

+4

, . linux 8 , ( segfault). .

++, , C-style ++.

std::vector<Struct_arr> arr_elem(150);

150 , , , " ", std::vector - .

, , .

+1

All Articles