What's a Declaration? What's a Definition?
2010-11-02 16:53
106 查看
Objects in C must have exactly one definition, and they may have mutiple external declarations.
Definition: occurs in only one place. specifies the type of an object; reserves storage for it; it is used to create new objects.
example: int my_array[100];
Declaration: can occur multiple times. describes the type of an object; is used to refer to objects defined elsewhere(e.g., in another file)
example: extern int my_my_array[];
difference between array and pointer.
Definition: occurs in only one place. specifies the type of an object; reserves storage for it; it is used to create new objects.
example: int my_array[100];
Declaration: can occur multiple times. describes the type of an object; is used to refer to objects defined elsewhere(e.g., in another file)
example: extern int my_my_array[];
difference between array and pointer.
相关文章推荐
- warning: its scope is only this definition or declaration, which is not what you want
- What's a Document Type Definition (DTD) and ...
- what is the difference between definition and declaration in c
- what is the difference between definition and declaration in c
- What is the difference between a definition and a declaration?
- What's a J2EE Dev To Do?
- What's a Heap?(什么是堆)
- 声明和定义 Declaration & Definition
- (NOT CLEAR) Question 14: What is the correct declaration for a file stream insertion operator for a class my_stuff::my_class a
- (原創) What's a good OO design? (OO)
- C++中definition与declaration的区别
- 声明(declaration),定义(definition),以及初始化(initialization)
- declaration(声明)与definition(定义)
- What’s a pre-borrow?
- what's this , it's a ruler
- What is Third party cookie definition
- Macro definition of snprintf conflicts with Standard Library function declaration
- C++基本概念总结——声明(declaration)和定义(definition)
- What's a namespace?
- [C/CPP系列知识] 在C中使用没有声明的函数时将发生什么 What happens when a function is called before its declaration in C