Scope determines where variables and functions are accessible.
void func() { int x = 10; // block scope { int y = 20; // inner block scope } // y is not accessible here }
int global_var = 100; // file scope static int file_var = 200; // file scope, internal linkage
void func(int param) { // parameter has function scope // param is accessible throughout the function }
void func(int x); // x has prototype scope only
int x = 10; // global void func() { int x = 20; // hides global x ::x = 30; // access global x (in C++) }