source file name: ArrMultiPtr.C
void multiptr(int *p)
{
int n,res,i;
for(i=1;i<=6;i++)
{
n=*p;
res=n*5;
printf(" %d ",res);
p++;
}
}
void main()
{
int *ptr;
int i;
int A[]={10,250,-50,400,100,-60};
clrscr();
printf("\n given array numbers: \n ");
for(i=0;i<6;i++)
printf(" %d ",A[i]);
printf("\n each array number muultipled by 5 using ponter:\n ");
ptr=&A[0];
multiptr(ptr); // calling function using pointer
getch();
}
output:
0 Comments
Post a Comment