Keil Logo

GENERAL: ERROR 141 (TOO MANY INITIALIZERS)


Information in this article applies to:

  • C51 Version 5.50
  • C251 Version 2.14
  • C166 Version 4.02

QUESTION

I have declared the following array:

const char blah[] = {"fd", 0x34};

When I compile my file I get:

ERROR 141: TOO MANY INITIALIZERS.

Why and how do I fix this?

ANSWER

This error was not generated in older versions of the compiler, but it has been introduced to avoid invalid initializations of an array.

You must change your declaration to:

const char blah[] = {"fd" "\x34"};

Note that the comma has been removed.

Alternatively, you can use a structure instead of the array to associate a string with a value.

Last Reviewed: Wednesday, June 9, 2004


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.