I've got some code I'm mantaining with the following variable declaration:
char tmpry[40];
It's being used with this function:
char *SomeFunction(char *tmpryP) {
// Do stuff.
}
The function call is:
SomeFunction(&tmpry[0]);
I'm pretty damn sure that's just the same as:
SomeFunction(tmpry);
I've even checked that the char* pointer in SomeFunction ends up pointing to the same memory location as the array in both cases.
My question is a sanity check as to whether the two function calls are identical (and therefore the original programmer was just being nasty)?
std::vector<char>) with overloadedoperator []expressionsxand&x[0]will get to mean very different things, and the second one is the one which fits better for my intent. Off course, all this doesn't matter so much for plain C, since you get almost none data abstraction in C anyway; thus the spelling with superior readability should be preferred.