# includevoid memory(int *, int, int); void memory1(char *, int, int); /* Definition of the function memory */ void memory(int a[], int l_b, int u_b) { int counter; for(counter = l_b; counter<=u_b; counter++) { printf("\n Element at location: 0x%x is %d", &a[counter], a[counter]); } printf("\n Array size = %d ", &a[counter-1] - &a[0] + 1); } void memory1(char b[], int l_b, int u_b) { char *pointer; int counter; pointer =&b[0]; for(counter = l_b; counter<=u_b; counter++) { printf("\n Element at location: 0x%x is %d", &b[counter], b[counter]); } printf("\n Array size = %d", &b[counter-1] - &b[0] + 1); } /*Function main */ void main() { int a[12] = { 99,88,77,66,55,44,33,22,11,100,200,300 }; char b[] = { 'A','B','C','D','E','F','G','H','I','J','K', 'L','M','N','O','P','Q','R','S','T','U','V', 'W','X','Y','Z' }; int lb=0, ub=11; memory(a,lb,ub); lb = 0; ub = 25; memory1(b,lb,ub); }
C program for Traversing a linear array
Here's the code for C program for Traversing a linear array
Next Article to Read
Among many other career blogs, Fun-The-Mentals is a different blog to help students achieve their goals.. This blog is maintained by Debashish and group. The blog is intended to bring decent and genuine information to the students of colleges and universities to help their preparation for job in the competitive world.
Add on Facebook
?
0 comments:
Post a Comment