# Queue of dynamic arrays

**URL:** <https://verificationacademy.com/forums/t/queue-of-dynamic-arrays/46024>\
**Category:** SystemVerilog\
**Tags:** SystemVerilog\
**Created:** [January 31, 2024, 4:36am UTC](https://verificationacademy.com/forums/t/queue-of-dynamic-arrays/46024 "2024-01-31T04:36:25Z")\
**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:** [January 31, 2024, 6:34am UTC](https://verificationacademy.com/forums/t/queue-of-dynamic-arrays/46024/2 "2024-01-31T06:34:12Z")

</div>

Your problem has to do with the placement of variable declarations, nothing to do with arrays. Because of the way Verilog defines the syntax for a `begin/end` blocks, variable declarations must come before any other statements. In your original example, `eleven` is declared after a function call and becomes a syntax error.

Your modified code is also illegal, but most tools just throw a warning. Best to move the variable declaration outside the initial block. See [Function arguments not initializing variable inside the body](https://verificationacademy.com/forums/t/function-arguments-not-initializing-variable-inside-the-body/31889)

---

_[View the full topic](https://verificationacademy.com/forums/t/queue-of-dynamic-arrays/46024)._
