Pages
Assignment
Synopsis
C
Graphics
Compiler
C#
DCN
DBMS
Discrete Math
DS
IT Fun
Java
Json
NIELIT
Notes
Office
OOPS
OS
PHP
Project
Phython
Question
SSAD
Web
UGC Net
VB
ASP
Saturday, 15 July 2017
Greatest Number from array using Pointer
Q : Write a program using pointer to find greatest number in an array.
Solution :
#include
<stdio.h>
#define
MAX 5
void
main()
{
int
ar[MAX],*pt,h,i;
for
(i=0;i<MAX;i++)
{
printf(
"Enter Number>> "
);
scanf(
"%d"
,&ar[i]);
}
h=ar[0];
for
(pt=ar,i=0;i<MAX;pt++,i++)
{
if
(*pt>h)
h=*pt;
}
printf(
"Highest Value is %d"
,h);
}
Download Source Code
Back
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment