What does it mean when arrays are defined like:
char a[256<<1];
char b[256<<1];
Can anyone see a reason why code would work when a is defined before b and not work when a is defined after b? Like this would not work:
char b[256<<1];
char a[256<<1];
...other code with a and b;
I don’t immediately see a reason because there’s no context. Possibly if there is a certain structure that the arrays belong in that is being accessed via pointer arithmetic then yes I can see a reason for this happening or just pointer arithmetic in general that assumes an order of a and b. Otherwise I see no reason as to why this would cause a failure. If you could provide context that would help.
What rearranging this has done is probably show a buffer overflow somewhere in your code (maybe a just overflowed into b before but now because of this new order a overflows into some other stack variables and makes weird things happen). This is quite common if you’re using unsafe calls such as gets for lines that are longer than 512 characters or something of the sort.
And FYI << is the left shift operator so it takes 256 and left shifts it by 1 bit which makes it 512.