answersLogoWhite

0


Best Answer

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;

}

User Avatar

Wiki User

2014-10-27 22:15:25
This answer is:
User Avatar
Study guides

What is a programming language

What does DOS stand for

What is a software that is distributed for free

What do unix and Linux have in common

➡️
See all cards
3.91
54 Reviews

Add your answer:

Earn +20 pts
Q: How do you declare local and global variables in pseudo code?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

How can you declare global and local variables in pseudcode?

You declare global and local variables in pseudocode the same way you declare them in real code. You place local variables within blocks, and you place global variables outside of all blocks.


How can you declare global an local variables in flowcharts?

Global and local variables can be displayed in flowcharts typically as overlays or in region specific flowcharts. General flowcharts on the base chart cannot accommodate multiple variations.


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 auto declaration in C?

Auto is one of the four storage classes in c. This is the default storage class. The auto storage class can be used only inside functions, i.e. only to declare local variables and not to declare global variables. All the local variables are by default auto variables. Other storage classes are: Register - variables declared may get stored in CPU registers instead of RAM Static - default storage class for global variables extern - defines global variables that is visible to all object modules


whose variables are also known as global variables?

The variables which are declared outside the main() function is known as global variables and they can be used anywhere in the program. And, the variables which used declare inside the main() function is known as local variables and they can be used inside the main() function only. Example: #include<stdio.h> #include<conio.h> int x,y; // global variables void main() { int a,b; // Local variables ------------ ---------------------- --------------------- getch(); }

Related questions

How can you declare global and local variables in pseudcode?

You declare global and local variables in pseudocode the same way you declare them in real code. You place local variables within blocks, and you place global variables outside of all blocks.


How can you declare global an local variables in flowcharts?

Global and local variables can be displayed in flowcharts typically as overlays or in region specific flowcharts. General flowcharts on the base chart cannot accommodate multiple variations.


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 auto declaration in C?

Auto is one of the four storage classes in c. This is the default storage class. The auto storage class can be used only inside functions, i.e. only to declare local variables and not to declare global variables. All the local variables are by default auto variables. Other storage classes are: Register - variables declared may get stored in CPU registers instead of RAM Static - default storage class for global variables extern - defines global variables that is visible to all object modules


whose variables are also known as global variables?

The variables which are declared outside the main() function is known as global variables and they can be used anywhere in the program. And, the variables which used declare inside the main() function is known as local variables and they can be used inside the main() function only. Example: #include<stdio.h> #include<conio.h> int x,y; // global variables void main() { int a,b; // Local variables ------------ ---------------------- --------------------- getch(); }


How do you declare global and local variables in pseudocode?

Pseudocode is not a programming language (it's specifically intended for human interpretation), so there is no need to declare variables, you simply define them as and when you require them. For instance: Let x = 42 Let y = x * 2


What are the differences between global variables and local variables in C plus plus?

Global variables can be seen in all blocks of your program, when local variables are visible only within the block where it's declared.


Are C variables initialized to 0 by default?

Only global/static variables are, local variables aren't.


How do you hide local variables in c and give precedence to global variables inside the function?

Hi, I would like to answr the question.So, if you want the to give more precedence to global variables with respect to a local one.Just add a pair of curly braces in the local variable and by doing so u can access global variable.


Where are local and global variables stored?

RAM = Random Access Memory


If most variables are local in a program instead of global the result is a program with low or high coupling?

Coupling is the interdependency of a program. A program that uses local variables is more independent than one that uses global variables. Therefore, the program would be considered to have lower coupling.


When is better to use global variables rather than utilizing local variables in a program?

In my opinion it is rarely a good idea to use global variables, unless you need to refer to them across modules, or their values need to be keep for a long period of program execution. Local variables should always be used when their lifetime is short, usually only in the module they are declared in. Global variables lifetime will be for the length of the program execution.

People also asked