很抱歉造成的不便。刚看了下XC8的编译器手册(https://ww1.microchip.com/downlo ... 0UG%20for%20PIC.pdf),看到里面提到不支持。
5.4.7 Dynamic Memory AllocationDynamic memory allocation, (heap-based allocation using malloc(), etc.) is not supported on any 8-bit device. Thisis due to the limited amount of data memory available, the memory banks which divide the memory and the wastefulnature of dynamic memory allocation.