2024-12-07 04:24:00 +00:00
|
|
|
int printf(char* format, ...);
|
2024-11-28 14:50:12 +00:00
|
|
|
|
2024-11-30 13:09:08 +00:00
|
|
|
void should_be(int expected, int actual) {
|
|
|
|
if (expected != actual) {
|
|
|
|
printf("Expected %d, but got %d\n", expected, actual);
|
|
|
|
} else {
|
|
|
|
printf("Passed\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int* p = 0;
|
2024-11-29 01:49:57 +00:00
|
|
|
int f1() {
|
|
|
|
int a = 1;
|
2024-11-30 13:09:08 +00:00
|
|
|
return *(a+(a+(a+(a+(a+(a+(a+(a+(a+(a+(p))))))))))); // p[10]
|
2024-11-29 01:49:57 +00:00
|
|
|
}
|
|
|
|
|
2024-11-28 14:50:12 +00:00
|
|
|
|
|
|
|
int main() {
|
2024-11-29 01:49:57 +00:00
|
|
|
int a[15];
|
|
|
|
p = a;
|
2024-11-30 03:19:13 +00:00
|
|
|
for (int i = 0; i < 15; a[i] = i, ++i);
|
2024-11-30 13:09:08 +00:00
|
|
|
p -= 5;
|
|
|
|
should_be(5, f1());
|
|
|
|
should_be(5, a - p);
|
|
|
|
should_be(10, 5);
|
2024-11-28 14:50:12 +00:00
|
|
|
}
|