char* test = new char[a];

Hi All, In our MCU, it didn't support this declaration, it says it is using GCC in C89 mode and the C89 standard.

char* test = new char[a];

Could you please advice?

Thank you very much!

Best regards, Boki.

Reply to
bokiteam
Loading thread data ...

Boki,

This is not valid C. It might be C++, but since I am no C++ programmer I can't say that for sure.

You are probably looking for something like this :

#include

char *test = malloc(a);

--
:wq
^X^Cy^K^X^C^C^C^C
Reply to
Ico

Thank you for advice.

Best regards, Boki.

Reply to
bokiteam

If you are in a C89 or C99 standard, the you are compiling C, which know of no new operator.

you should: a) either use malloc and free instead of new and delete, and keep on programming in C

b) or change to C++, compiler option -sdt=c++98

Whichever fits you.

Best regards,

Zara

Reply to
Zara

Got it, thanks.

Best regards, Boki.

Reply to
bokiteam

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.