c語言findmax函數(shù) c語言用指針編寫findmax函數(shù)找到最大值并輸出其下標?
c語言用指針編寫findmax函數(shù)找到最大值并輸出其下標?#include<stdio.h>int findmax(int*p,int n){int i int max=0 for(i=0 i
c語言用指針編寫findmax函數(shù)找到最大值并輸出其下標?
#include<stdio.h>int findmax(int*p,int n){int i int max=0 for(i=0 i< n i)if(p[i]> p[max])max=i printf(%dn,p[max])return max}int main(void){int buf[5]={6,
2,9,
1,8}findmax(buf,5)return 0}