No their behaviour may look like same but it is not. There are actually three kinds of storage categories; static, automatic, and dynamic. Static and automatic storage are part of the declaration of a variable of any type. Automatic variables get allocated and initialized when entering a procedural scope like a task or function and they get deallocated when exiting the scope. Dynamic storage is associated with the variable’s type. You can procedurally change the size of an array, queue, or string, as well as construct a class object as any time.
Generally, we can't access local variables outside their function or task directly. However, if the variable is static, as explained in the video, it can be accessed. For automatic variables, hierarchical references are not allowed. To work around this, you can declare a variable in the module (outside the function/task) and assign the local automatic variable to this module-level variable inside the function/task. This way, when you need to print or use the variable outside the function/task, you can simply use that module variable.
Keep rising 😊
✌️❣️
Thank you so much mam. Very well explained.
Thank you
Ma'am Can we say automatic and dymanic is same ?
No their behaviour may look like same but it is not.
There are actually three kinds of storage categories; static, automatic, and dynamic.
Static and automatic storage are part of the declaration of a variable of any type. Automatic variables get allocated and initialized when entering a procedural scope like a task or function and they get deallocated when exiting the scope.
Dynamic storage is associated with the variable’s type. You can procedurally change the size of an array, queue, or string, as well as construct a class object as any time.
mam explain how to access the automatic ,,, increment_static.count_b
Generally, we can't access local variables outside their function or task directly. However, if the variable is static, as explained in the video, it can be accessed.
For automatic variables, hierarchical references are not allowed. To work around this, you can declare a variable in the module (outside the function/task) and assign the local automatic variable to this module-level variable inside the function/task. This way, when you need to print or use the variable outside the function/task, you can simply use that module variable.
Thankyou mam
We_Lsi verify
+Chip verify!