answersLogoWhite

0

A variable is declared by declaring its name and type. Once a variable is declared you can use it in expressions, whether to assign a value or use the value. The name is also a reference to the memory address allocated to the variable, thus you can take the address of the name if required.

User Avatar

Wiki User

9y ago

What else can I help you with?

Continue Learning about Engineering

Why can you not declare void variables in c?

All names must be declared in C so that the compiler knows what each name represents even if the definition of that name has not yet been compiled. Without a declaration, the compiler cannot know what operations are permitted upon the name and therefore cannot notify the programmer of syntax errors.


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.


Why you need to declare variable 1st in turbo c plus plus?

In C++ all names (including variables) must be declared before they can be used.


What are the functions of a storage class?

There are four storage class specifiers in C and C++. These are - 1. auto : The storage specifier auto refers to automatic variable declaration. The life of an automatic variable is the time during which its parent function is running. The scope of an auto variable is the function scope. They can be accessed only from their parent functions. Syntax : auto int a; 2. register : A register variable has all the characteristics of an auto variable. The only difference is that auto variable uses the main memory to store data and register uses the CPU registers. 3. extern : This storage specifier is used to declare a global variable. The life of these variables is the time during which the program runs.


What is the syntax of foreach in c?

There is no 'foreach' in C

Related Questions

How you declare a variable in c language?

you have to give a statement in the following syntax datatype variable;


What is syntax in c plus plus for declaring a variable?

type variable {[optional array size]} {= optional initializer};


How do you use define in C?

Just type declare then the variable that you desire to assigned a certain constant value on it. Just type declare then the variable that you desire to assigned a certain constant value on it.


How do you increment hex value in c?

First a variable in numeric data type is to be defined. Then increment the number using the ++ command syntax of C,


Why variable name is not start with digit in programming language?

Because the compilers do not allow that, you would get a 'Syntax error' if you tried.(In FORTH, mind you, variable names can start with digits, for example:VARIABLE 0A ( declare variable )10 0A ! ( assign value )0A @ ( fetch value ))


What is syntax in declaring a variable?

type your answer here


Why can you not declare void variables in c?

All names must be declared in C so that the compiler knows what each name represents even if the definition of that name has not yet been compiled. Without a declaration, the compiler cannot know what operations are permitted upon the name and therefore cannot notify the programmer of syntax errors.


Is it corrrect to declare a variable in c or c plus plus as two or three words for eg int seg no?

No., If you want to declare you jus use _ in between so the declaration will be like int seg_no;


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.


What are the32 key words in c turbo?

key words are the specfic command of the program like variable name, syntax, name of loops.


Why you need to declare variable 1st in turbo c plus plus?

In C++ all names (including variables) must be declared before they can be used.


How do you declare a pointer variable in c?

int* pint; // instantiate a pointer to an int. float* pflt; // instantiate a pointer to a float.