String as an array index

前端 未结 3 1346
刺人心
刺人心 2021-01-19 04:35

In 3[\"XoePhoenix\"], array index is of type array of characters. Can we do this in C? Isn\'t it true that an array index must be an integer?

What does

3条回答
  •  感情败类
    2021-01-19 05:06

    In C, arrays are very simple data structures with consecutive blocks of memory. They therefore need to be integers as these indices are nothing more than offsets to addresses in memory.

提交回复
热议问题