answersLogoWhite

0


Best Answer

the declaration is int a - you are declaring a variable type integer. Definition is when you define a variable or give it a value, so a = 10 would be a definition

Answeri have an doubt.. i have read somewhere that whenever memory allocation takes place , it is called definition. and declaration just tells the nature of variable. in int a; --- the memory allocation is taking place. so it should be the definition.kindly reply and clarify my doubt. AnswerWhen you declare it, you tell it what its type it. (int a) that's when the compiler knows how much to allocate for it.

you define it as a=10, or a=20000.

AnswerThis refers to both definition and declaration why because it is allocating the memory in the statement

int a;

or

int a =10;

extern int a;

is an declaration.

Answerint a; This is a declaration, declaring that 'a' is a variable of type int which would occupy 4 bytes(in a 32-bit compiler). Here no memory space is allocated. But when you say, a=10; Here 'a' is given 4 bytes (actual memory allocation) when value 10 is stored. This is called definition.

-Sushant Sharashchandra Painaik

AnswerActually 'a10;' can be a 'useless calculation' or an 'undefined variable'.

'int a;' and 'int a=10;' are both definitions; whilst 'extern int a;' is just a declaration.

in C, all variables should be declared to tell the compiler what the variable names are,and what type of data they hold. the variables must be declared b4 they are used. here int a; is declaration and a= 10 is its data type value.

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: In C Language if you write int a; a10; then which is Declaration and which is Definition of variable a?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is the definition for defining the variable?

choosing a variable to represent one of the unspecified numbers in a problem and using it to write expressions for the other unspecified numbers in the problem.


Why extern long int var is a declaration?

Because it doesn't define the variable. If you want to define it, simply write: long int var;


Who was selected to write the declaration of the independence?

Thomas Jefferson was chosen to write the Declaration Of Independence


What did Benjamin Franklin write in the Declaration of Independence?

His name he did not write the declaration of independence he signed it


Who was selected to write to declaration of independence?

Thomas Jefferson was chosen to write the Declaration Of Independence


Who was elected to write the Declaration of Independence?

The Continental Congress chose Thomas Jefferson to write the Declaration of Independence.


Who is the delegate from Pennsylvania that helped write the Declaration of Independence?

Ben Franklin helped write the declaration of independence!


Where did Texans write the Declaration of Independence?

Texans did NOT write the Declaration of Independence. Texas did not exist in 1776 when Jefferson wrote it. Texas had nothing to do with the Declaration.


How do you write a function in Turbo C Plus Plus?

// declaration: return_type function_name([argument_type_1[=value][, argument_type_2[=value][, ...]]]); // definition (function signature must match declaration): return_type function_name([argument_type_1 argument_name_1[, argument_type_2 argument_name_2[, ...]]]) { // implementation } In the case of separate declaration/definition, the definition file must include the file that contains the declaration unless they are both in the same file. If the function is a template function, both the declaration and the definition must be visible to the compiler BEFORE it can be used (thus they must both be in the same file). For all other functions other than inline expanded functions, only the declaration need be visible. Note that the definition is also a declaration, however default values must be omitted and all arguments must be named. The declaration arguments may also be named but they needn't match those in the definition (the definition names are the ones actually used). Alternatively: // combined declaration and definition: return_type function_name([argument_type_1 argument_name_1[=value][, argument_type_2 argument_name_2[=value][, ...]]]) { // implementation } Functions that are defined in the declaration are impicitly inline expanded. Functions that are defined separately must be prepended with the inline keyword in the definition, and the definition must be visible to the compiler BEFORE the function can be used. Functions that do not return a value must return void. If any other return type is specified, the function must explicitly return that type via all return paths. The main function must return an int, however return(0) is implied if not specified in the final statement.


How do you write variable in a sentence?

Here is a example. "I wrote variable in a sentence."


Write a program in c language to implement framing methods like character stuffing?

A program in c language to implement framing methods like character stuffing can be grave sizeCRC-32 and the variable c50.


Did Benjamin Franklin Paul Revere both help write the declaration of independce true or false?

DiDid Paul Revere help write the Declaration of Independence?d Paul Revere help write the Declaration of Independence?