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

28 lines
482 B
C
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// 以下程序的输出结果是(
// 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;
}