



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




What is a Variable? Definition
Variable Initialization Initialization is assigning an initial value to a variable at the time of declaration.
Declaration Only
Declaration + Initialization
Variable Scope Scope defines the region where a variable is accessible and valid.
void myFunc() { int x = 10; // Local } Valid only within the function block
int x = 5; // Global void myFunc() { // Can use x here } Accessible throughout entire program
for (int i = 0; i < 10; i++) { } // i exists only in loop | if (x > 5) { int y = 20; } // y exists only in block