[Pointers and C-String]D. Liang 7.5 Finding the smallest element

Description

Write a function that returns the smallest element of an array with the following headers:

int smallestElement(int * array, int size);

Hint

Don’t submit the main() function.

//   Date:2020/5/1
//   Author:xiezhg5
int smallestElement(int * array, int size) {
	//和数组一样 
	int *p,*array_end,min;
	min=*array;
	array_end=array+size;
	for(p=array+1; p<array_end; p++)
		if(*p<min)
			min=*p;
	return min;
}

你可能感兴趣的:(Matrix)