I am working on a project written in C programming language. I got a code snippet as below
unsigned char value[10];
#define arr() (&value[0])
Why have they defined a "function"(arr()) kind of #define'd variable for an unsigned char array?
They are trying to use the variable like arr()[1],arr()[2] etc.,
- Is
arr() + 2equal tovalue + 2. I tried executing a small program, but theses two results gave me different answers. how is it possible. Because they are assigning the address of first array toarr(). Should these two not be the same?
Can anyone explain what is the significance of defining a variable as above?