answersLogoWhite

Top Answer
User Avatar
Wiki User
Answered 2008-05-05 10:52:25

The keyword "static" in C has a slightly complicated meaning, depending on where it is used. It generally denotes static storage, meaning that it is allocated in the static data area of the program, and not on the stack or heap. Also, it generally limits the visibility of the name to a certain area of the code.

If used on a variable or function of global scope, then it generally means that the function or variable can only be used by other functions within the same file, as opposed to "extern" which means that the variable and function can be used from other files.

If used on a local variable within a function, it means that the variable maintains its value between function calls (since it is allocated statically and not on the stack).

001
๐Ÿ™
0
๐Ÿคจ
0
๐Ÿ˜ฎ
0
๐Ÿ˜‚
0
User Avatar

Your Answer

Still Have Questions?

Related Questions

Dynamic and static scope in c language?

Static


What is the definition of the term C static?

The term C static is a variable within computer programming in particular C Language. When set static the variable inside a function keeps its value between invocations.


What is the application of static and extern storage classes in C?

There are four storage classes in ca) autob) registerc) staticd) extern


What is static extern variables in C?

In c static and global variables are stored in data segment ( which is a special memory in RAM)


Difference between static members and static functions?

c: A static function is visible only in the source file containing it. A static member is not defined. c++: A static function is visible only in the source file containing it. A static member variable is common to all instances of a class. A static member function is used to access static members.


What are the features of static data members in c?

C does not support static data members. You are probably talking about C++ static data members. These are data members that are local to the class in which they are declared, rather than local to objects of the class as per non-static data members.


What does static mean?

static - stationary, standing, not moving


Static variable in c?

A static variable in C is one in which the memory is preallocated before the execution unit begins and lasts for the entire program unit.A non-static variable in C will be allocated in the block in which it is contained, and destroyed outside that block.


What is the difference between static variable and global variable declaration?

When you say static variable, do you mean local static variable or global static variable? In C, the difference between global static variables and global variables is that static in this case means that the variable can be used only in the module (.c file) that it is declared. The difference between a local static variable and a global variable is the scope: the local variable can be used only inside the function that declares it. So you can have 2 local static variables in the same file with the same name but in different functions and they will be 2 different variables.


What does static mean in a dictonary?

Static means 'stationary', or 'not moving'.


Why does C plus plus allows static binding and not dynamic binding?

C++ allows both static and dynamic binding. Static binding occurs at compile time. Dynamic binding occurs at runtime.


Open fopen create files. How to you create a folderdirectory?

In Visual C++, or C# you can use static method Directory or non-static DirectoryInfo.


What is static char in C?

static storage class in C tells that: The variable will have the default value as zero. The variable scope will be the file in which it is defined. RaVi


Why inline function cannot be static?

Inline functions can be static. However, their usage outside of classes in C++ has been deprecated (a hangover from C). Static member functions are allowed of course, and they can be inline expanded where desired. In C, a static function simply has limited scope within the same translation unit. In C++, unnamed namespaces are the preferred method of achieving the same end.


When do you declare a member of a class static in c plus plus?

In C++, a static class member is common to all instances of that class. A static class method is a method that can only access static class members. Non static methods can also access static members, but remember that there is only one instance of that member amongst all instances of the class. One advantage of a static method is that you do not have to instantiate the class to use the static member or static method.


What is a static identifier in C?

In C, a variable declared as static in a function is initialised once, and retains its value between function calls. The default initial value of an uninitialized static variable is zero. If a function or global variable is declared static, it can only be accessed in that file.


What is meant by static identifier?

Nothing. I guess you mean a static variable.


What is meant by 'static' in C plus plus?

Static in C/C++ means that the variable will keep its value across calls to the function. ex: func() { static int x=0; ++x; cout << x << endl; } main() { func(); func(); func(); } This will print: 1 2 3 *NOT* 1 1 1


Explain static function in c plus plus?

A static function in C++ is the same as a static function C. Unlike standard, non-static functions which are accessible outside of the file in which they are declared, static functions are local to the file in which they are declared. C++ also allows static functions to be declared inside a class. These static member functions are members of the class and have unrestricted access to all other members of the class, including other static members and instance members, but they are not associated with any instance of the class (they can be called even when there is no instance of the class) and therefore they have no access to an implicit this pointer. They are used to provide general functionality that is closely associated with the class, and often make use of the class' static member variables.


What does static eletiricity mean?

Static in static electricity means still because it does not move, unlike regular electricity.


What is the scope of a static function in C?

The source file it is in.


What are the storage class in c?

It are static, auto and extern.


What is static binding and dynamic binding in c?

Static binding applies to basically all c function calls.Dynamic binding applies to calls to function pointers.


Can you declare an object inside static number function in c?

No, because there are no objects in C.


What does static in static electricity mean?

static in static electricity is the bombardment of electron from super natural energy towards the current.it occupy a space in current cavities..thus the staticity icreases...this is the static in static electricity


Still have questions?