answersLogoWhite

0

Declaration is a promise: 'I will define (or has defined) this variable/function somewhere else'.

User Avatar

Wiki User

15y ago

Still curious? Ask our experts.

Chat with our AI personalities

ReneRene
Change my mind. I dare you.
Chat with Rene
RafaRafa
There's no fun in playing it safe. Why not try something a little unhinged?
Chat with Rafa
TaigaTaiga
Every great hero faces trials, and you—yes, YOU—are no exception!
Chat with Taiga

Add your answer:

Earn +20 pts
Q: Difference between declaring a variable and definition a variable?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Math & Arithmetic

Difference between variable resistor and rheostat?

The difference between a variable resistor and a rheostat is the same as the difference between six and half a dozen.


What is the difference between declaring variable and initializing variables?

Actually, there is a third step, call definition. Declaration is a statement to the compiler of what type an identifier is, definition is the allocation of memory for that identifier, and initialization is the assignment of an initial value to that identifier. Usually, declaration and definition are done together, but you can also add initialization in that step if desired. int a; /* declaration and definition */ a = 1; /* initialization */ int a = 1; /* declaration, definition, and initialization */ For the case of seperate declaration and definition, consider the struct... struct _mystruct { int a; }; /*declaration */ struct _mystruct mystruct; /* definition */ struct _mystruct { int a; } mystruct; /*declaration and definition */ Note: To be more precise: struct _mystruct; /* struct declaration */ struct _mystruct { int a; }; /* struct definition */ typedef struct _mystruct MYTYPE; /* type definition */ extern struct _mystruct mystructvar; /* variable declaration */ struct _mystruct mystructvar; /* variable definition */ struct _mystruct mystructvar = {7} ; /* variable definition with initialization */ struct _mystruct { int a; } mystruct; /* struct definition and variable definition */ extern struct _mystruct { int a; } mystruct; /* struct definition and variable declaration */


What is one difference between a variable expression and a numerical expression?

The variable.


Deifference between declaration and definition?

Declaring a variable or function reserves an entry in a symbol table for that function or variable (entries in a symbol table eventually become memory addresses during linkage). Defining a variable or function actually specifies the value to be stored in the memory location specified and/or the code that should be compiled. Examples: Declaration: int foo(); // Declares a function. int bar; // Declares a variable. Definition: int foo() { printf("Hello World"); } bar = 5; Declaration and definition: int bar = 5;


What is the difference between a variable and a literal in prgramming?

a literal is a constant value, the difference is a variable can change it's value.