answersLogoWhite

0


Best Answer

variable exit within a function and curly braces is local variable

int main()

{

int x;

}

User Avatar

Wiki User

โˆ™ 2012-04-14 05:31:18
This answer is:
User Avatar
Study guides
๐Ÿ““
See all Study Guides
โœ๏ธ
Create a Study Guide
4.18
โ˜†โ˜…โ˜†โ˜…โ˜†โ˜…โ˜†โ˜…โ˜†โ˜…
11 Reviews

Add your answer:

Earn +20 pts
Q: How you can declare local variable?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is variable scope in programming?

variable scobe means which is used to declare the variable in a block local or global position this is a related ans


How do you declare local and global variables in pseudo code?

You would declare them how you would in a real programming language. Let's say I have a function called foo. function foo() { variable = 1; } Inside that function is a variable called variable. That is a local variable since it is declared only within the function body. As soon as that function returns, the variable ceases to exist. In order to declare a global variable, you would declare it outside of any function, thereby making it accessible to the entire program. variable2 = 2; function foo() { variable = 1; }


How can you declare global and local variable in pseudocode?

A local variable is a variable declared inside a construct, such as a class or function, while a global variable is a variable declared outside of any construct.


What is a declaring variable?

Variable declaration is when you declare a variable. For example: String foo; The data type is String and now I can modify foo and don't need to type String again. It can be an instance variable or a local variable.


Why you use static class in c?

static is not a class it is a storage class which is used to declare a local-scope variable.


Why all variables are declared with in the function?

It is not necessary to to declare variables inside the function in C. If you declare a variable inside a function, the variable becomes local for the function and another variable of same name can be declared in any other function, but you can not use the variable declared in other function. When you declare any variable outside the function body then the variable becomes global and can be used in any function of the program. Note: errno is an example for a variable declared outside any function.


How do you declare an integer variable?

datatype variable name;


Where the local variables will be stored?

When you declare a variable and it's data type in a function, it is stored in the specific space for memory allocated by the variable type identifier known as the "stack."


How can you declare global and local variable in flowcharts?

In Raptor: Global variables are to be displayed in the assignment window, while the local ones need to be input into the input box.


What is the difference between declaring static variable as local and global?

There are two ways to declare varibles. 1. Locally 2. Globally When you declare a variable locally in any function that means it is only accessible by that function. When you declare a variable globally so it is accessible by all the functions in the program. Declaring variables with static keyword means you are setting its value null.


What is a local variable?

Local variable is a variable having local scope. Local variable has higher priority than global priority.


How do you declare correct variable in c?

we can declare a variable using the following syntax datatype variablename; actually variable is the name given to the memory location which store values.

People also asked