#include<stdio.h>
#include<conio.h>
void main()
{
int a[20],i,d;
int *ptr,*big=0;
clrscr();
printf(" \n Enter dimension : ");
scanf("%d",&d);
printf(" \n Enter %d values : ",d);
for(i=0;i<d;i++)
scanf("%d",&a[i]);
ptr=a;
for(i=0;i<d;i++)
{
if(*big < *ptr)
*big=*ptr;
if(*low<*ptr)
*low=*ptr;
ptr++;
}
printf("\n Elements of Array a : \n");
for(i=0;i<d;i++)
printf("%d\t",a[i]);
printf("\n The biggest value Of ARRAy : %d",*big);
printf("\n The lowest value of ARRAy : %d",*low);
getch();
}
#include<conio.h>
void main()
{
int a[20],i,d;
int *ptr,*big=0;
clrscr();
printf(" \n Enter dimension : ");
scanf("%d",&d);
printf(" \n Enter %d values : ",d);
for(i=0;i<d;i++)
scanf("%d",&a[i]);
ptr=a;
for(i=0;i<d;i++)
{
if(*big < *ptr)
*big=*ptr;
if(*low<*ptr)
*low=*ptr;
ptr++;
}
printf("\n Elements of Array a : \n");
for(i=0;i<d;i++)
printf("%d\t",a[i]);
printf("\n The biggest value Of ARRAy : %d",*big);
printf("\n The lowest value of ARRAy : %d",*low);
getch();
}
it is not working
ReplyDeletecheck the modified code... hope it will help you...
Deletehey, it will be work just a little bit of modification to be done. try this code, it works...
ReplyDelete#include
#include
void main()
{
int a[10],i,n,*p,low,high;
clrscr();
printf("\nenter the size");
scanf("%d",&n);
for(i=0;ihigh)high=*p;
p++;
}
printf("largest is %d, smallest is %d",high,low);
getch();
}
it not working is shows the value of any unknown address or garbej value
ReplyDelete