- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPointer_Array.cpp
More file actions
Latest commit
23 lines (22 loc) · 533 Bytes
/
Copy pathPointer_Array.cpp
File metadata and controls
23 lines (22 loc) · 533 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include<stdio.h>
#include<conio.h>
intlargest(int *, int);
voidmain()
{
int i, no_terms, a[10];
printf("Enter the Number of Elements of the Array :: ");
scanf_s("%d", &no_terms);
printf("\nEnter the Elements of the Array :: ");
for (i = 0; i < no_terms; i++)
scanf_s("%d", &a[i]);
printf("\nThe Largest Element of the Array is :: %d ", largest(a, no_terms));
_getch();
}
intlargest(int *g, int n)
{
int max = *g, i;
for (i = 1; i < n; i++)
if (*(g + i) > max)
max = *(g + i);
return max;
}