Tuesday, July 26, 2005

extern variables

Compile and run “a.c”

/*file a.c*/

#include <stdio.h>

#include "b.c"

int a=5;

int main()

{

f();

return 0;

}

----EOF--------------

 

/*file b.c*/

#include <stdio.h>

int a;

void f()

{

printf("%d\n",a);  /*it prints 5*/

}

---------------EOF---------------------------

 

Pradyut
http://pradyut.tk
http://groups.yahoo.com/group/d_dom/
http://groups-beta.google.com/group/oop_programming
India

 

No comments: