hi,
i have defined an array as : uint8_t list_array[size]; in a function.
when this line gets executed, the control is jumping to exit. c file and suspends the program execution.
how to use variable length arrays?
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
hi,
i have defined an array as : uint8_t list_array[size]; in a function.
when this line gets executed, the control is jumping to exit. c file and suspends the program execution.
how to use variable length arrays?
Hi Vidya,
how to use variable length arrays?
In C language, you cannot vary the size of the array in runtime. The array size will be fixed at compile stage only.
If you want to create a dynamic array (i.e. you want to change the size in runtime), then you should use linked lists.
Linked List vs Array - GeeksforGeeks
Array vs linked list | What's the difference? - javatpoint
--
Thanks & regards,
Jagadish.
Hi,
variable length arrays is an additional feature from C99 Standard.
I guess this feature is present in the compiler of CCS, since it hasn't resulted any compiler error when i have defined this array.
even in debug mode, it didn't result any error instead jumped to an abort function which is inbuilt in this SDK.
I would like to know more about loader_exit and abort function which i have attached previously.
Please go through the below link.
https://www.geeksforgeeks.org/variable-length-arrays-in-c-and-c/