answersLogoWhite

0

You declare a variable by first defining its data type and then its name followed by a semi-colon. Here is an example:

int variable;

The example above declares an uninitialized integer variable. You can initialize the variable by giving it a value such as "int variable = 1;". It is important to initialize your variables, because you can get errors when executing your program that the variable does not have a value or is uninitialized. Variables that are uninitialized have whatever garbage value happens to be when the program is executed.

Here are all of the data types that a variable can be:

*int - integer value

*char - character value

*bool - boolean value

User Avatar

Wiki User

11y ago

What else can I help you with?