Pages
Home
C++/C- Programs
DOS Commands
BS Communication
Mathematics
Advertisement
About Us
Contact us
Wednesday, January 30, 2013
Count Array elements with Pointers ( homework )
#include<stdio.h>
#include<conio.h>
void main()
{
int a[20],i,*p,ct=0,n;
clrscr();
p=&a[0];
printf("\n\t\tEnter N : ");
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",p);
ct=ct+*p;
p++;
}
printf("\n\n\tYour Ans is = %d",ct);
getch();
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment