It’s good practice to add the information which MCU you’re using. Sometimes issues are HW or port related. Also it’s better to markdown code blocks for readability by enclosing it in 3 tildes (optionally with a language tag appended to the lead-in mark.
E.g. markdown of C-code: ~~~c ...code block... ~~~
The main stack must not be used for variables given as arguments for tasks because the main stack is reset and reused as ISR stack e.g. for Cortex-M3/4/7 MCUs.
static, global or heap allocated variables can be used, of course.
See for example this post here in the forums. There are some more - it’s a pitfall