有如下程序段:int arr[]={10,20,30},*ptr=arr;++*ptr;printf(“%d”,arr[0]);则执行上述程序段后输出结果为( )
A: 10
B: 20
C: 11
D: 21
A: 10
B: 20
C: 11
D: 21
举一反三
- 有如下程序段: int arr[]={10,20,30},*ptr=arr; ++*ptr; printf(“%d”,arr[0]); 则执行上述程序段后输出结果为
- 下列程序段的输出结果为: int arr[]={6,7,8,9,10}; int * ptr; ptr=arr; * (ptr+2)+=2; printf ("%d,%d ",*ptr,*(ptr+2));
- 设有如下定义: int arr[]={6 ,8 ,9 ,10}; int * ptr; 则下列程序段的输出结果为 ptr=arr ; *(ptr+2)+=2 ; printf ("%d ;%d\n" ,*ptr ,*(ptr+2)); A: 8 ;10 B: 6 ;8 C: 7 ;9 D: 6 ;10
- 设有如下定义:int arr[ ] = {6, 7, 8, 9, 10}; int *ptr; ptr = arr; *(ptr + 2) += 2;printf("%d, %d ", *ptr, *(ptr + 2));则程序段的输出结果为( )。 A: 8, 10 B: 6, 8 C: 7, 9 D: 6, 10
- 预测下面程序的输出:// PROGRAM 1#include <stdio.h>int main(void){ int arr[] = {10, 20}; int *p = arr; ++*p; printf("arr[0] = %d, arr[1] = %d, *p = %d", arr[0], arr[1], *p); return 0;}// PROGRAM 2#include <stdio.h>int main(void){ int arr[] = {10, 20}; int *p = arr; *p++; printf("arr[0] = %d, arr[1] = %d, *p = %d", arr[0], arr[1], *p); return 0;}// PROGRAM 3#include <stdio.h>int main(void){ int arr[] = {10, 20}; int *p = arr; *++p; printf("arr[0] = %d, arr[1] = %d, *p = %d", arr[0], arr[1], *p); return 0;}