int *a;
printf("Enter the size of the arrays\n");
scanf("%d", &n);
a = (int *)malloc(n * sizeof(int));
for (i = 0; i < n; i++)
{
scanf("%d", a + i);
}
k=largearr(a+i);
printf("Largest element = %d",*k);
return 0;
}
int largearr(int *c)
{
for (i = 1; i < n; ++i)
{
if (*c < *(c+i))
*c = *(c+i);
}
return *c;
}
Guys can anybody rectify where i did wrong i want print largest number in an array using pointers and function includes malloc ?
what is the error
ironman then your and my code are similar then
Обсуждают сегодня