Reassignment of Variable Properties - MATLAB & Simulink (original) (raw)
Main Content
For C/C++ code generation, there are certain variables that you can reassign after the initial assignment with a value of different class, size, or complexity:
A variable can hold values that have the same class and complexity but different sizes. If the size of the initial assignment is not constant, the variable is dynamically sized in generated code. For more information, see Variable-Size Data.
Variables reused in the code for different purposes
You can reassign the type (class, size, and complexity) of a variable after the initial assignment if each occurrence of the variable can have only one type. In this case, the variable is renamed in the generated code to create multiple independent variables. For more information, see Reuse the Same Variable with Different Properties.