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.

[参考译文] TMS570LS1224:如图所示、当一个可变长度数组被执行时、跳至中止。

Guru**** 1859600 points
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1309260/tms570ls1224-jumping-to-abort-when-a-variable-length-array-is-executed-as-shown

器件型号:TMS570LS1224

您好!  

我已经 在函数中将数组定义为: uint8_t list_array[size];。  

当此行执行时、控件跳转至退出。 并暂停程序执行。

  

  

如何使用可变长度数组?

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Vidya:

    [quote userid="588114" url="~/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1309260/tms570ls1224-jumping-to-abort-when-a-variable-length-array-is-executed-as-shown 如何使用可变长度数组?

    在 C 语言中,不能在运行时改变数组的大小。 数组大小只能在编译阶段固定。

    如果要创建动态数组(即要在运行时更改大小),则应使用链接列表。

    链接列表与数组- GeeksforGeeks

    阵列与链接列表|区别是什么? - javatpoint

    --
    谢谢。此致、
    Jagadish。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好!

    可变长度数组是 C99 Standard 提供的一项附加功能。

    我想这个特性出现在 CCS 的编译器中、因为在我定义这个数组时、它并未产生任何编译器错误。

    即使在调试模式下、也不会导致任何错误、而是跳转到此 SDK 中内置的中止函数。

    我想进一步了解我之前附加的 loader_exit 和 ABORT 函数。

    请单击以下链接。

    https://www.geeksforgeeks.org/variable-length-arrays-in-c-and-c/

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Vidya:

    您能否也分享您的代码以在我的终端进行验证和调试?

    --
    谢谢。此致、
    Jagadish。