Definitions

From vegard.wiki
Revision as of 07:13, 14 February 2020 by Vegard (talk | contribs) (new page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Definitions and declarations look much the same in C; it can also be difficult to tell the difference between initialization and assignment because they use the same symbol. Here I am just trying to visually lay out the various types of statements in order to show clearly what their differences and relationships are.

C/C++

Variable Function
Type Global Local (Global)
Declaration
extern int x;
extern int fn();
Definition
int x;
int fn() { ... }
Initialization
int x = 1;
Assignment
x = 1;

See also