On 22-Jul-97, Fernando Ariel Gont wrote to Kurt Kuzba about I want to learn
C++.
FAG> /*: DECLARE.C -- Declaration/definition examples */
FAG> extern int i; /* Declaration without definition */
FAG> /* OK, I UNDERSTAND IT! */
Note: this does not allocate space for i.
FAG> extern float f(float); /* Function declaration */
FAG> /* OK! */
Note: same as above.
FAG> float b; /* Declaration & definition */
FAG> /*WHY IS IT A DEFINITION? */
Beacuse it allocates space for b.
FAG> float f(float a) { /* Definition */
FAG> return a + 1.0;
FAG> }
FAG> /* WHY ISN'T IT A DECLARATION & DEFINITION? */
Beacuse this is f()'s body, f() is already declared.
FAG> int i; /* Definition */
FAG> /* WHY ISN'T IT A DECLARATION? */
cause i is already declared.
FAG> int h(int x) { /* Declaration & definition */
FAG> return x + 1;
FAG> }
FAG> /* OK! I UNDERSTAND IT PERFECTLY, BUT THERE IS A PIECE OF CODE AVOVE */
FAG> /* THAT IS VERY SIMILAR TO THIS, AND THE WRITER SAID THAT IT WAS A */
FAG> /* DEFINITION ONLY...... WHAT ABOUT THIS?? */
cause f() was already declared, h() is not.
Javier Kohen [The_Crusher] http://jkohen.base.org
... Kill it now. þ Worf
-!- CrusherTag 0.3.2.
--- Terminate 4.00/Pro
---------------
* Origin: The King of The Ring (4:900/748.3)
|