C programming array to function 05-24-2012, 05:56 PM
#1
hello guys, the source below is related to array and function..in which entire declared array get passed to a function called show and in this function each number get multiplied by 3 and after that print outs new modified number.
if you faced any problem feel free to ask
Code:
main()
{
int n[]={1,2,3,4,5};
int *r,i=0;
clrscr();
show(&n[i],5);
r=&n[i];
while(i<5)
{
printf("%d\t",*r);
++r;
++i;
}
getch();
}
int show(int *j,int n)
{
int i;
for(i=0;i<n;++i)
{
*j=*j*3;
++j;
}
}if you faced any problem feel free to ask




![[+]](https://sinister.li/images/modern/collapse_collapsed.png)