---
title: "static variable"  
description: "static variable"  
author: "Anonymous User"  
published: 2018-07-06  
updated: 2018-07-06  
canonical: https://www.mindstick.com/forum/34587/static-variable  
category: "python"  
tags: ["c#", "python"]  
reading_time: 1 minute  

---

# static variable

What does [static](https://www.mindstick.com/articles/12098/the-static-keyword-the-static-methods) [variables](https://www.mindstick.com/articles/715/php-variables) [mean](https://yourviews.mindstick.com/view/80768/what-does-real-minority-mean) ?

## Replies

### Reply by Prakash nidhi Verma

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.

```
 #include<stdio.h> 
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):
        self.name = name            // Instance Variable
        self.roll = roll
// Objects of CSStudent class
a = CSStudent('Prakash', 1)
b = CSStudent('Nidhi', 2)
print(a.stream)
print(b.stream)
print(a.name)
print(b.name)
print(a.roll)
print(b.roll)
print(CSStudent.stream)
```


---

Original Source: https://www.mindstick.com/forum/34587/static-variable

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
