static variable

Total Post:113


C#  Python 
 442  View(s)
Rate this:

What does static variables mean ?

  1. Re: static variable

    Static variables :

    access qualifier are known as static var. variable as static inside a function is declared than, the scope is less to the function, but it will exists for the life time of the program. Values will be persisted between successive calls to a function.

    int fun() 
    {  static int count = 0;  count++;  return count; 
    }  int main()  {  printf("%d ", fun());  printf("%d ", fun());  return 0;  } 

    in python it does not require for static keywords. inside this classs the method having instant var.

    class CSStudent: 
        stream = 'cse' // Class Variable     def __init__(self,name,roll): = name // Instance Variable         self.roll = roll // Objects of CSStudent class a = CSStudent('Prakash', 1) b = CSStudent('Nidhi', 2) print( print( print( print( print(a.roll) print(b.roll) print(


Please check, If you want to make this post sponsored

You are not a Sponsored Member. Click Here to Subscribe the Membership.