Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



Static variable initialization

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 31-12-2009
Member
 
Join Date: Aug 2006
Posts: 253
Static variable initialization
  

I know how to initialize a static variable. My variable is a structure, I know initialize a variable type int, double, etc. .. But not a structure.
I use a class and I want my obj1 variable to static so that it is common to all objects :
Code:
  class Position (
     private:
         static object 
     public:

Reply With Quote
  #2  
Old 31-12-2009
Member
 
Join Date: Apr 2008
Posts: 2,005
Re: Static variable initialization

You can initialize the value of a static local variable as part of its declaration.The initial values of global and static variables are stored in ROM in a segment called ?C_INITSEG. If you declare an array to be Static, you can initialize its rank (number of dimensions), the length of each dimension, and the values of the individual elements.
Reply With Quote
  #3  
Old 31-12-2009
Member
 
Join Date: May 2008
Posts: 2,012
Re: Static variable initialization

In computer programming, a static variable is a variable that has been allocated statically — whose lifetime extends across the entire run of the program.Variables defined local to a function disappear at the end of the function scope. So when we call the function again, storage for variables is created and values are reinitialized. This is in contrast to the more ephemeral automatic variables, whose storage is allocated and deallocated on the call stack; and in contrast to objects whose storage is dynamically allocated.
Reply With Quote
  #4  
Old 31-12-2009
Member
 
Join Date: May 2008
Posts: 2,297
Re: Static variable initialization

A static variable, also referred to as a class variable, is a variable which exists across instances of a class.You can declare static variables with the same name in more than one procedure. A static object of class type will use the default constructor if you do not initialize it. Automatic and register variables that are not initialized will have undefined values.If you do this, the Visual Basic compiler considers each such variable to be a separate element. The opposite of a static variable is an instance variable, which is a variable related to a single instance of a class.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Static variable initialization"
Thread Thread Starter Forum Replies Last Post
Servlet static variable Sheenas Software Development 5 06-03-2010 11:24 AM
Runtime Error 91 : Object Variable or with block variable not set Ryan21 Software Development 2 28-08-2009 07:51 PM
Is it possible to have static variable in python? gvBlake Software Development 2 21-07-2009 09:56 PM
What is Global Variable static? Declaring static variable instead of Global variable Reckon Software Development 3 25-04-2009 11:34 AM
Can we use static variable in other programming languages FlayoFish Software Development 2 25-04-2009 10:56 AM


All times are GMT +5.5. The time now is 07:21 AM.