answersLogoWhite

0


Best Answer

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).

User Avatar

Wiki User

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

Wiki User

9y ago

There is no such thing. Aside from the fact C is not object oriented, the entire concept of a static constructor makes no sense in any object oriented programming language, including C++. Constructors have an implicit this pointer but static methods do not; they are not associated with any instance of the class. Static methods can be invoked even when no instances of the class exist; they are scoped to the class, not to an object of the class.

This answer is:
User Avatar

User Avatar

Wiki User

10y ago

Static variables and constants are allocated upon the stack and remain in scope for the duration of the program's lifetime. All static variables and constants must be initialised. The visibility of a static depends on where it is declared. For instance, a static variable declared within the scope of a function is only accessible within that function, but remains in scope when the function ends (its value remains the same between calls). By the same token, static members are scoped to the class rather than to an instance of the class, thus are accessible even when no instance of the class exists. Static methods differ from instance methods in that static methods have no access to the this pointer, which is only relevant to instance methods. If a static member is used internally by the class and by friends of the class, then it should be declared private. To be made visible to derivatives of the class as well it should be declared protected. To be made visible to all code it should be declared public.

This answer is:
User Avatar

User Avatar

Wiki User

12y ago

Static at file scope means that the item has visibility only within the file, i.e. it does not have external scope.

Static at block scope means the the item has run-time persistence, i.e. its value persists from the moment it is initialized to the moment the program exits.

This answer is:
User Avatar

User Avatar

Wiki User

12y ago

static refers to something you want to compile just one time .

Like what ?

If we have a school & class for every student contains his/her data

if we wanted to count the students .... we then need single variable to count in

so we make a static variable in the class that increases by one every creation

that variable won't be created in the ram every time due to the static keyword

& that's Y we use static var.s ;)

This answer is:
User Avatar

User Avatar

Wiki User

14y ago

A static array is no different than any other static class variable - it is an array that is associated with the class itself and is common to all objects of that class.

This answer is:
User Avatar

User Avatar

Wiki User

13y ago

My guess is variable declaration, more correctly:

static int explicit;

...

explicit= 12;

printf ("explicit is %d\n", explicit);

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

It apears to be a global type of varible (aka array) that does not depend or become specific to a certain class or function.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is static in c plus plus programming?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Why study c plus plus programming?

we are using c plus plus programming for developing object oriented programing software.


Differentiate C plus plus and Turbo C?

Turbo C is a software where C or C++ programming environment resides in.But C++ is itself a programming language.


Is c plus plus a modular programming?

No, but it does support modular programming through namespaces.


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 are the two major types of programming languages in c plus plus?

Object oriented programming and structured programming.


What is the purpose of C plus plus?

Computer programming.


What is c plus plus primarily used for?

Programming.


What is the significance of c plus plus?

C++ is an object oriented programming language


What are the different storage class in C programming?

Automatic, register, external, static


What is the use of c plus plus in banks?

Programming language.


What is the best website for C plus plus programming?

www.cplusplus.com


Algorithm of push and pop in c plus plus?

pop push c++ programming