Warning: excess elements in array initializer

Source: Internet
Author: User
Warning: excess elements in array initializer

Warning the array Initial Value Setting item contains redundant elements (the defined array length is smaller than the number of values assigned)

/* Global processing character mode. The default character */static char * g_echo_flag_show [echo_chg_max] = {"min", "NONE", "No chg", "upper ", "lower", "Max"};/* Conversion Mode */typedef Enum {echo_chg_min,/* invalid value */echo_chg_none,/* No Conversion Mode Set */echo_chg_nochg, /* No conversion, direct return */echo_chg_upper,/* To uppercase letters */echo_chg_lower,/* to lowercase letters */echo_chg_max/* invalid value */} echo_chg_type;

Echo_chg_max is used as the last enumeration and the value is 5. Therefore, the array length is g_echo_flag_show [5], but the assigned value contains 6 strings, so a warning is reported.

Change

Static char * g_echo_flag_show [echo_chg_max + 1] = {"min", "NONE", "No chg", "upper", "lower", "Max "};

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.