Forward declaration

Forward Declaration

Forward declaration

to get instant updates about 'Forward Declaration' on your MyPage. Meet other similar minded people. Its Free!

X 

All Updates


Description:
In computer programming, a forward declaration is a declaration of an identifier (denoting an entity such as a type, a variable, or a function) for which the programmer has not yet given a complete definition.

<source lang="c">void print(int);</source>

In C++, the line above represents forward declaration of a function and is the function's prototype. After processing this declaration, the compiler would allow the programmer to refer to the entity <code>print</code> in the rest of the program; but at some point the programmer would still have to provide a definition for the declared entity:

<source lang="c">void print(int x) </source>

In Pascal and other Wirth programming languages, it is a general rule that all entities must be declared before use. In C, the same general rule applies, but with an exception for undeclared functions and incomplete types. Thus, in C it is possible (although unwise) to implement a pair of mutually recursive functions thus:

<source lang="c">int first(int x)

int second(int x) </source>

In Pascal, the same implementation requires a forward declaration of <code>second</code> to precede its use in <code>first</code>. Without the forward declaration, the compiler will produce an error message indicating that the identifier <code>second</code> has been used without being declared.

Forward reference

The term forward reference is sometimes used...
Read More

No feeds found

All
Posting your question. Please wait!...


No updates available.
No messages found
Suggested Pages
Tell your friends >
about this page
 Create a new Page
for companies, colleges, celebrities or anything you like.Get updates on MyPage.
Create a new Page
 Find your friends
  Find friends on MyPage from