answersLogoWhite

0

scope of a variable is the part of the code within which the variable is defined or the part of your code within which the th variable can be used for example

#include<stdio.h>

void main()

{

int variable1

}

now this variable (variable1) that we have used can be used anywhere within the main function .but if i write a code as shown below

#include<stdio.h>

void function1(int a)

void main()

{

int variable1

}

void function1(int a)

{

sum=variable1+variable1;

}

the compiler wouldn't know what variable1 ,being used in function1 is.

we therefore say that variable1 has a scope within the main only

if however we would have written int 'variable1' immediately after #include<stdio.h> then 'variable one would have been a global variable and could have been used anywhere within the code

User Avatar

Wiki User

15y ago

What else can I help you with?

Related Questions

What does c x b mean?

The variable c times the variable b simply equals cb. Just as the variable x times the variable y would equal xy, and so on.


What does increments mean in C programming?

It has nothing to do with C, it simply means: add 1 to a variable.


What do you mean by initialization in c plus plus?

Not initialized variable: int myInt; Initialized variable: int myInt = 10;


Why you use count in simple interest program in c?

You mean 'count' as variable-name? It is optional.


When an experiment showes that one variable makes another variable change and no other variable has any effect what is the experiment showing?

causation


In a graph what is the variable on the horizontal axis?

Independent Variable c:


What is the variable of a cloud?

c


What does 12 equals p of c mean?

If we're talking strictly algebra. 12 equals p of c can be written as: 12= p(c) meaning, 12 is the answer for some function p, when c is the variable.


What is Variable Scope?

The scope of a variable is the range, or area, in which a variable exists. // this c is global and can be referenced from anywhere int c = 1; void foo() { // this c is local to function foo and can't be referenced from the outside int c = 2; } void bar() { // if we try to reference c here, we get the value 1 from the global variable }


What variable represents specific heat in the equation mcT?

variable c


What is a variable in C language?

variable which is used to specify the values and also we can that values through the variable name


What does C mean in math?

It doesnt me anything in particular but its a variable that stands for a number UMMM NO! She/he means as a measurement. not a variable. =P