Best Answer

declaration is like a promise that somewhere else the thing in question will be actually defined.

User Avatar

Wiki User

โˆ™ 2011-08-10 11:27:08
This answer is:
User Avatar
Study guides
See all Study Guides
Create a Study Guide

Add your answer:

Earn +20 pts
Q: What is definition and declaration in C?
Write your answer...
Still have questions?
magnify glass
Related questions

What is the difference between declaration and a definition in c plus plus?

A declaration is an incomplete type whereas a definition is a complete type.

When variable in c gets memory After declaration or initialization?

Definition. Example: extern int x1; /* declaration */ int x2; /* definition */ int x3= 2; /* definition with initialization */

Where do arguments appear within a C program?

within function call, declaration and definition

Can you explain the structure of a C program?

Something like this: program -> <empty> program -> type-definition program program -> type-declaration program program -> variable-definition program program -> variable-declaration program program -> function-definition program program -> function-declaration program

What is the use of extern in c language?

In C and C++, extern is a declaration of a variable or function, said declaration including the fact that the definition of that variable or function will occur in a different compilation unit, linking provided by the link editor or binder.

Where do arguments appear in c program?

During function call and function definition and Declaration. These are the three places where arguments appear in C Program.

What is the difference between declaration and a definition in C with small example?

declaration examples:int main (void);extern int somevariable;definition examples:int main (void) { puts ("Hello world"); return 0; }int somevariable;

What is the difference between declaration and definition?

definition: the meaning or description of person/place/thing declaration: taking a stand

What is difference between declaration an definition in c language?

The term declaration is used when referring to variables. It means that the compiler is told about the type, name, as well as allocated memory cell for variable of a variable. The later action of the compiler, allocation of storage is called the definition of the variable. Example: Declaration of variable: extern int a; Definition of a variable: int a=5;

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 */

C programming language bsc it notes?

different between defining value definition section and defining value declaration section

Is there anything you can do in C but not in C Plus Plus?

== Yes. It may be funny. You cannot use keywords like newin c++ for variable declaration. But in C it is possible.== The following definition is valid in C, invalid in C++: char str [3] = "ABC";

What is the definition of the Declaration of Independence?

an important document

What is variable definition in c language?

variable definition means to declare the variable with its value. for example:- int i=10; this statement is a combination of declaration of integer i and assign its value to it,so it is a definition statement Note: assigning a value is not essential.

What is the definition for factors of productions?

th declaration of independence

What is difference between declaration of variable in c and declaration of variable in c plus plus?

There is no difference, other than that declarations in C++ can also initialise the variable in a single instruction. C example: int x; // declaration x=5; // initialisation C++ example: int y=5; // declaration and initialisation combined.

What is the difference between declaration and initialization?

Perhaps an example will help. extern int value; /* declaration */ int value; /* definition */ int value= 20; /* definition with initialization */

What is function definition in C plus plus?

actually ++ in c++ represents the advanced version of the language 'c'. Whereas c dont has any full form. In c ,c ++ means c =c +1 I think the question goes more to what "function definition" means. C++ (and many other languages) requires that that a function (any symbol really) must be known to the compiler before you actually try to use it. This is called the "function declaration" and simply specifies the signature of the function. The "function definition" then is the actual implementation of the function. You can declare and implement a function at the same time but normally you will split your source code into a header file (.h) containing the declarations and an implementation file (.cpp) containing the the definitions. For example: Declaration: class A { .... void doSomething(); } Definition: void A:doSomething() { // Your implementation here }

Definition of C programming and C?


What is True in C programming A multiple fn definitions and multiple declarations B 1 declaration multiple fn definitions C 1 fn definition 1 declaration D multiple declaration 1 definition?

A function's declaration must be visible within every translation unit that uses that function, thus multiple declarations are permitted. To ensure consistency across all translation units that use a function, the declaration is usually placed in a header which can be included wherever it is needed. Formal arguments need not be named in a declaration (they do not form part of the function's prototype), but named arguments can provide better documentation and need not match the names used by the definition, or indeed by any other declaration of the same function. Note that a definition is itself a declaration, thus if a function is declared (but not yet defined), there has to be at least two declarations because the function must be defined somewhere. The "one definition rule" (ODR) implies there can only ever be one definition of a function, however multiple definitions are permitted provided those definitions appear in different translation units and are token-for-token identical (including the names of formal arguments). Being token-for-token identical means there is only one definition. Thus the correct answer is D: multiple declarations with one definition.

What is the syntax of function?

Function declaration, definition, or calling? Pick one.

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.

In a dictionary does the definition come after the word?

Yes. Often a pronunciation guide and a declaration of word type precede the definition.

What was the introduction in the Declaration of Independence?

It was the Preamble, and it was in there b/c it has the reasons for writing the Declaration in the first place.

What is the definition of c-rations?

C stands for compound.