Default type when int a; is declared

if we declare a int a; so is it static int by default ?

it depends on where you declare the variable, if its declared in module then its static, if its declared in class then it becomes automatic.

2 Likes

Depending on where the int is declared its scope and lifetime changes. If it is declared outside Module, program, interface, task or function, this will have static lifetime and local to compilation unit.
If it is declared inside module, program, interface but outside task, process or function the scope will be local but lifetime will be static.

1 Like

It’s true it depends on where the variable is declared, but it’s lifetime could be static, automatic, or dynamic. See The Life of a SystemVerilog Variable.

1 Like

Thanks @dave_59 @RajratnaChauhan @kedar