char* test = new char[a];

Jan 16, 2006 4 Replies

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.



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

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

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required