用指针查找数组中的最大值 从键盘输入10个整数存入整型数组中,输出该数组中的最大值及其下标,要求通过指针访问该数组的元素?
从键盘输入10个整数存入整型数组中,输出该数组中的最大值及其下标,要求通过指针访问该数组的元素?#includeint main(){int a[10],i,*p=a,*q=afor(i=0i<1
从键盘输入10个整数存入整型数组中,输出该数组中的最大值及其下标,要求通过指针访问该数组的元素?
#include
int main()
{int a[10],i,*p=a,*q=a
for(i=0i<10p,i)
{scanf(%d,p)
if(*p>*q)q=p
}
printf(“Max=a[%d]=%dn,q-a,*q)
getch()
return 0
}