Files
suanfa/public/c/ch2/ch2.allpai/arrpaichong.c
T

19 lines
451 B
C
Raw Normal View History

2026-06-14 23:45:55 +08:00
#include <stdio.h>
#include <stdbool.h>
#define SIZE 10
int main() {
int arr[SIZE] = {2, 5, 3, 5, 1, 2, 6, 7, 8, 9};
bool used[SIZE] = {false}; // 用于标记数字是否已被使用
for (int i = 0; i < SIZE; ++i) {
if (!used[arr[i]]) { // 检查当前值是否已被使用
printf("First occurrence of %d\n", arr[i]);
used[arr[i]] = true; // 标记该值为已使用
}
}
return 0;
}