Initializing Variables

Variables can be initialized and defines anywhere in the program. Following example will demontrate how to define variables and declare variables.

Example

#include <iostream>

int main() {
    int i = 0; // initialize single variable
    int a=10,b=20,c=30; // initialize multiple variables
    std::cout<<"a "<<a<<" b "<<b<<" c "<<c<<" i is "<<i;
	getchar();
	return 0;
}

Output

a 10 b 20 c 30 i is 0