Write a c program to find maximum & minimum elements using Pointers.
#include<stdio.h> #include<conio.h> main() { Int i, n,min,max a[10]; int * p; printf(“enter how many elements”); ...
https://www.computersprofessor.com/2016/06/write-c-program-to-find-maximum-minimum.html?m=0
#include<stdio.h>
#include<conio.h>
main()
{
Int i, n,min,max a[10];
int *p;
printf(“enter how many elements”);
scanf(“%d”, &n);
printf(“enter elements”);
for(i=0; i<n; i++)
scanf(“%d", &a[i]);
p=&a[0];
min=*p,
max = *p;
for (i=0; i<n; i++)
{
if(*p<min)
min = *p;
if(*p>max)
max=*p;
p++;
}
printf(“max=%d \t min=%d”, max,min);
getch();
}