如果要在聲明數組時初始化,填入數組的必須是常量,而你寫入的字母編譯器不認。
如果你真的是想用字母初始化數組,那么用下面的寫法:
uint table1[] = { 'a','f','g','h','j'};
uint table2[] = { 'q','w','e','r','t','y','o'};
如果單純的想定義一個字符串可以用以下寫法:
1、聲明char型數組
char table1[] = "afghj";
char table2[] = "qwertyo";
2、聲明char型指針
char* table1 = "afghj";
char* table2 = "qwertyo"; |