Actually, no. Success of this construct depends on context.
If init is a pointer (which includes arrays that are arguments of functions) then the above is not guaranteed to work as you expect.
If init is actually an array, then that construct gives the number of elements in that array.
For example;
Code:
#include <iostream>
void f(char *p)
{
std::cout << "In f() " << sizeof(p)/sizeof(p[0]) << '\n';
}
int main()
{
char p[5];
std::cout << "In main() " << sizeof(p)/sizeof(p[0]) << '\n';
f(p);
return 0;
}
You will find that this code will print different values in main() and in f().