Why can't I use sizeof on foo::i in a member function but I can use it in main()?
Code:#include <iostream>
class foo {
public:
static int i[];
void bar()
{
int s = sizeof(i); //gives error C2070: 'int []': illegal sizeof operand
}
};
int foo::i[] = {1,2,3};
int main()
{
int s = sizeof(foo::i);
}