I take a test test in C ++, and I am confused with a set of access areas and questions related to the declaration. Both questions are related to each other. I know the answers. What I need is the correct explanation:
What is the value of the local variable x at the end of the main
int x = 5;
int main(int argc, char** argv)
{
int x = x;
return 0;
}
ans: Undefined
What is the value of y at the end of the main?
const int x = 5;
int main(int argc, char** argv)
{
int x[x];
int y = sizeof(x) / sizeof(int);
return 0;
}
answer: 5
source
share