how to acces global variable in seperate file written function

9 views
Skip to first unread message

san!

unread,
Dec 14, 2008, 4:50:24 AM12/14/08
to C/C++ Users' Group
hey i have 1 prob.


the source code,functions r defined,now i want to cal one of functions
from
source code,,in source code header files r defined..




now to execute that function ,,i had included header files,,,but i am
not getting
how access the global variables used in original source code,,the as
we r not passing them in function that r writteen by me.

suraj

unread,
Dec 20, 2008, 5:58:37 AM12/20/08
to c-cp...@googlegroups.com
use "header.h" in place of <header.h> or u can give full path of the file.It may reside in other dircectory not in local dir.If file is xxx.cpp than round off the main function from the program only define the function and golbal variable .and include .cpp file also as mentioned above.

thunder...@gmail.com

unread,
Dec 21, 2008, 9:53:13 AM12/21/08
to C/C++ Users' Group
thanks...for rpl...i got its solution by "extern" keyword

On 20 Dec, 15:58, suraj <raju.d...@gmail.com> wrote:
> use "header.h" in place of <header.h> or u can give full path of the file.It
> may reside in other dircectory not in local dir.If file is xxx.cpp than
> round off the main function from the program only define the function and
> golbal variable .and include .cpp file also as mentioned above.
>
Reply all
Reply to author
Forward
0 new messages