# Variable declared inside a static function

**URL:** <https://verificationacademy.com/forums/t/variable-declared-inside-a-static-function/35005>\
**Category:** SystemVerilog\
**Tags:** SystemVerilog\
**Created:** [September 7, 2018, 12:13pm UTC](https://verificationacademy.com/forums/t/variable-declared-inside-a-static-function/35005 "2018-09-07T12:13:33Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![dave\_59](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/dave_59/32/4499_2.png) [@dave\_59](https://verificationacademy.com/forums/u/dave_59)\
**Post date:** [September 7, 2018, 3:04pm UTC](https://verificationacademy.com/forums/t/variable-declared-inside-a-static-function/35005/2 "2018-09-07T15:04:29Z")

</div>

_In reply to [Manoj J](https://verificationacademy.com/forums/t/variable-declared-inside-a-static-function/35005):_

‘a’ is an automatic variable that gets initialized to 0 on each call to get(). You can declare ‘a’ as a static variable if thst is what you want.

The syntax   
static function static was made illegal in the 1800-2009 LRM to prevent the confusion you are having now.

See [automatic variables inside static method | Verification Academy](https://verificationacademy.com/forums/systemverilog/automatic-variables-inside-static-method#reply-42858)

---

_[View the full topic](https://verificationacademy.com/forums/t/variable-declared-inside-a-static-function/35005)._
