W3School TIY Editor
W3School 在线教程
改变方向
暗黑模式
#include
int main() { int numbers[3] = {10, 20, 30}; int index = 5; printf("索引 = %d\n", index); if (index >= 0 && index < 3) { // 确保索引在有效范围内(0 到 2) printf("值 = %d\n", numbers[index]); } else { printf("错误:索引超出范围!\n"); } return 0; }