A Variable Declaration Statement.

Q14. What does the computer do when it executes a variable declaration statement? Give an example.

Ans. A variable is a box, or location, in the computer’s memory that has name. The box holds a values of some specified type. A variable declaration statement is a statement such as

int x;

which creates the variable x. When the computer excutes a variable declaration, it creates the box in memory and associates a name (in this case, x) with that box. Later in the program, that variable can be referred to by name.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s