Login Register






C programming array to function filter_list
Author
Message
C programming array to function #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.

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
[Image: 262s21x.jpg]






Messages In This Thread
C programming array to function - by jammy7777 - 05-24-2012, 05:56 PM