qfedu-c-level/day10/homework/h8.c

28 lines
482 B
C
Raw Normal View History

2023-07-15 17:55:35 +08:00
// 以下程序的输出结果是(
// A17 B18 C19 D20
// main()
// {
// int a[] = {2, 4, 6, 8, 10}, y = 1, x = 0, *p = NULL;
// p = &a[1];
// for (; x < 3; x++)
// y += *(p + x);
// printf(“% d\n”, y);
// }
#include <stdio.h>
int main()
{
int a[] = {2, 4, 6, 8, 10},
y = 1,
x = 0,
*p = NULL;
p = &a[1];
for (; x < 3; x++)
y += *(p + x);
printf("%d\n", y);
return 0;
}