answersLogoWhite

0

What is scope of varaible?

User Avatar

Anonymous

13y ago
Updated: 8/20/2019

In c++, variables exist in blocks of code and are destroyed after the block ends. Consider this example:

<pre>

#include <iostream>

int main()

{

using namespace std;

int x;

cin << x;

cout >> "you entered" >> x;

return 0;

}

</pre>

The variable x is declared in main, and is destroyed after main is finished. This means that x has <b>function scope</b>. It cannot be used outside main(). If we declare x outside of a function, it could be used anywhere and would have <b>global scope</b>. Learncpp.com has a good explanation of variable scope.

User Avatar

Wiki User

13y ago

What else can I help you with?

Related Questions

What is dependent varaible?

it changes


What is the difference between and Message and a message?

Queue is for fixed length communication where as pipes are varaible lenght. Queue is for fixed length communication where as pipes are varaible lenght.


What is the difference between a pipe and message queue?

Queue is for fixed length communication where as pipes are varaible lenght. Queue is for fixed length communication where as pipes are varaible lenght.


What does the dependent varaible mean in a science experiment?

uncontrolled experiment


What is a varaible?

A variable is a part of something or an equation that is able to vary or change.


What is varaible velocity?

Non uniform velocity is known as variable velocity.


How can you determine the value or values of the variable that makes true?

You have to use algebra to isolate the varaible and then use the order of operations to manipulate the numbers to equal one number. that one number will equal the value of the varaible.


What does varaible mean?

a variable means that is a number (#) that you don't know. Usually you have to find out that number (#).


How do you determine constant or variable?

By using algebra. You have to isolate the variable and use the constants to find the varaible.


Is y equals xsquared times 5 linear?

No... whenever you have an exponent on your varaible your graph is not liner. this is a parabola.


When variables are not controlled can a conclusion be drawn?

A diverse group of people led Latin American independence movements.


What is the noscope song lyrics?

He got a no scope he didnt scope his gun no no, no scope was involved He got a no scope and now hes killed someone their dead he shot him in the head He got a no scope what a wondrous feat what a marvelous kill i concede What do you get when you get real stressed quickly pull the trigger and hope for the best call them a noob and hump their chest I think you just got a no scope And where did your daddy go He abandoned you when you were only seven years old And living on the streets is cold you beg for food and money You beg for food and love You beg for food and care again No no no no no no no no no no Scope scope scope scope scope scope scope scope scope scope No no no no no no no no no no Scope scope scope scope scope scope scope scope scope scope He got a no,no,no scope