Meh*_*hdi 3 arrays shell vxworks
如何在VxWorks shell中定义数组?
例如,如果我想要以下内容:
myArray[3] = {1,2,3};
Run Code Online (Sandbox Code Playgroud)
我不确定你可以直接。您也许可以使用例如 malloc 分配一些内存,然后根据您想要的值设置内存 - 应该像下面这样
//Allocate the array
-> myArray = malloc( 3 )
// use the m Command to edit the memory
-> m &myArray
// do this for each element you want to set
-> 0x12ff3120 1
-> 0x12ff3121 2
// Check the memory
d &myArray
-> 0x12ff3120: 0001 0002 0003 0000
Run Code Online (Sandbox Code Playgroud)
假设您想要一个 char 大小的元素数组,这是可行的。对于其他大小,请修改 m 命令以在例如字大小的块中进行编辑:
->m &myArray 4
Run Code Online (Sandbox Code Playgroud)