examples of declarations of external


Examples of declarations of external variables  that  are  not definitions:

extern char stack[10];

extern int stkptr;

These declarations tell the compiler that the variables stack[] and stkptr are defined elsewhere, usually in some other file. If the keyword extern were omitted, the variables would be considered to be new ones and memory would be allocated for them. Remember, access to the same external variable defined in another file is possible only if the keyword extern is used in the declaration.

/* File : ext.c

This example shows reference to an external variable in more than one file. The program is organized in three files. The external variable 'a1' is defined in 'ext.c', and it is declared as extern in 'FILE3.c' */

 

 

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: examples of declarations of external
Reference No:- TGS0305504

Expected delivery within 24 Hours