Find a simple algorithm for finding prime numbers. Don't overcomplicate it.
Well, what should the compiler assume?
Code:
int main(void)
{
int y;
y = 5; /* there is only 1 y, so the compiler knows which one to use. */
return 0;
}
Note the giant braces. When you say, y = 5, it looks for y inside the current braces. If there was a global variable also named y, then the compiler would still use the one inside main(). It assumes that you mean the most inner-declared variable.
It won't look inside other functions, though, for a variable. A valid variable is either inside the current set of braces, inside the current function, or declared globally. That's about it.