主页
C 语言
C 调试
demo_debugging_array
运行 ❯
×
更改方向
保存代码
更改主题
#include
int main() { int numbers[3] = {10, 20, 30}; int index = 5; printf("Index = %d\n", index); if (index >= 0 && index < 3) { // Make sure the index is within the valid range (0 to 2) printf("Value = %d\n", numbers[index]); } else { printf("Error: Index out of bounds!\n"); } return 0; }
Index = 5
Error: Index out of bounds!