[Error] initializer-string for array of chars is too long [-fpermissive]

created at 06-21-2022 views: 9

problem

zimu_biao[52]="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
char shuzi_biao[10]="0123456789";

display error

[Error] initializer-string for array of chars is too long [-fpermissive]

When the character array is initialized, the size of the array must be greater than the length of the string + 1, otherwise a compilation error will occur.

solution

zimu_biao[53]="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
char shuzi_biao[11]="0123456789";
created at:06-21-2022
edited at: 06-21-2022: