Definition vs declaration

#include <stdio.h>union test1;    // declarationunion test2 {  // The definition of union test2    int a;}union test3 {   // The test4 definition of type union test3    int b;} test4;

declaration : 告訴 compiler 如何解讀 identifier,及接受這個 reference of identifier,也就是類似 extern int a;translation unit 沒有定義 a,所以先接受有 a,先 compile,link 階段再連結。

definition of object : 在 memory 配置一塊 空間儲存其值,link phase時, linker 會去連結變數。

definition 可以用在 define union test1,define object,不是每個定義,都會配置 memory:

感受不同地域不一样的节奏与表象。

Definition vs declaration

相关文章:

你感兴趣的文章:

标签云: