answersLogoWhite

0


Best Answer

Storage classes are used to indicate duration and scope of a variable or identifier. Duration indicates the life span of a variable. Scope indicates the visibility of the variable. The static storage class is used to declare an identifier that is a local variable either to a function or a file and that exists and retains its value after control passes from where it was declared. This storage class has a duration that is permanent. A variable declared of this class retains its value from one call of the function to the next. The scope is local. A variable is known only by the function it is declared within or if declared globally in a file, it is known or seen only by the functions within that file. This storage class guarantees that declaration of the variable also initializes the variable to zero or all bits off. The extern storage class is used to declare a global variable that will be known to the functions in a file and capable of being known to all functions in a program. This storage class has a duration that is permanent. Any variable of this class retains its value until changed by another assignment. The scope is global. A variable can be known or seen by all functions within a program.

User Avatar

Wiki User

17y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

14y ago

no they cant ... static says ... hey my var is within file scope. extern says .. var is defined some where else .... static var definition cant be seen by other file via their translation tables.... SO extern with static is an erroneous combination sujay0987@Yahoo.com

This answer is:
User Avatar

User Avatar

Wiki User

14y ago

extern variables are defined in different than the file where the main() is. extern variables can be accessed from other files. Static global variables are visible only within the file.

This answer is:
User Avatar

User Avatar

Wiki User

12y ago

global means: defined here, available from everywhere

external means: defined elsewhere

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Can you use extern and static together?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Auto static extern register?

Storage classes.


What is meant by the storage class of a variable?

auto, extern, static, register, typedef (only formally)


What is storage classes in c plus plus?

AUTO EXTERN STATIC are the storage classes in c++


How i useStatic extern int a in c?

No such thing, pick one ot the three: static int x; extern int x; int x;


What are the storage classes in c?

A storage class defines the visibility and lifetime of variables or/and functions within a C Program. There are following storage classes which can be used in a C Program: auto register static extern


What is different storage class in c?

Different from what? Storage classes are auto, register, static, extern and typedef (formally).


How java use extern key word which is used in C plus plus?

No extern keyword in Java.


Why inline functions shall not be defined with extern or static storage class?

inline itself should be considered as a storage class


What are the modofier in turbo C?

You can use every standard C modifier in TurboC: long, short, signed, unsigned; and every storage class as well: static, extern, auto, register, typedef.


What is extern C used for?

extern specifies that the variable is in another file.say you have a variable(int k = 10) in mycpp1.cpp and you want to use it in mycpp2.cpp use the extern to redeclare the variable and use it.Example:Code://mycpp1.cppint k = 10;Code://mycpp2.cppextern int k;void function(void){cout


What does extern C stand for?

"extern" is short of "external" which means outside.


Should one add static friction and kinetic friction together to find the total friction force?

No. You use whichever applies: if an object is at rest, you use static friction. If it is moving, you use kinetic friction.