If static int temp; defined in one file1, then can we use this same temp variable in file 2 ? Is it possible to do this with EXTERN ?

Showing Answers 1 - 12 of 12 Answers

sudharma

  • Nov 23rd, 2006
 

Yes, you can use the temp variable in file 2 by doing extern static int  temp.

  Was this answer useful?  Yes

sunil

  • Nov 30th, 2006
 

No you can not use a variable which is made static in one file in other

  Was this answer useful?  Yes

Arun

  • Nov 30th, 2006
 

Hi,

  We can't able to use more than one storage class specifier in same variable.

Regards,

ARUN

  Was this answer useful?  Yes

kalayama

  • Dec 5th, 2006
 

Well, the static variable should not be accessed from outside the file in hich it is defined. That's how static is defined.The intended purpose of static is to make the variable "invisible" to other programs.Hence you must use extern if you want to access it across files.Cheers,Kalayama

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions