Commit b5550a50 authored by elijah vasquez's avatar elijah vasquez 🦍

changes made to ex 4

parent ed343199
...@@ -3,22 +3,23 @@ ...@@ -3,22 +3,23 @@
int main(void) { int main(void) {
int a[] = {1,1,1,1}; int a[6] = {1,1,1,1,1,1};
int b[] = {2,2,2,2}; int b[6] = {2,2,2,2,2,2};
int c[4] = {4,4,4,4};
for (int i=0;i<4;i++) for (int i=0;i<6;i++)
{ {
printf("array a[%d] %d at address %p\n",i,a[i], &a[i]); printf("array a[%d] %d at address %p\n",i,a[i], &a[i]);
} }
printf("\n"); printf("\n");
for (int i=0;i<4;i++) for (int i=0;i<6;i++)
{ {
printf("array b[%d] %d at address %p\n",i,b[i], &b[i]); printf("array b[%d] %d at address %p\n",i,b[i], &b[i]);
} }
printf("\n"); printf("\n");
for (int i=0; i<8; i++) for (int i=-2; i<10; i++)
{ {
b[i]=3; b[i]=3;
printf("setting array b[%d] to %d at address %p\n",i,b[i], &b[i]); printf("setting array b[%d] to %d at address %p\n",i,b[i], &b[i]);
...@@ -37,6 +38,11 @@ for (int i=0;i<4;i++) ...@@ -37,6 +38,11 @@ for (int i=0;i<4;i++)
} }
printf("\n"); printf("\n");
for(int i = 0; i < 4; i++)
{
printf("array c[%d] %d at address %p\n",i,b[i], &b[i]);
}
printf("\n");
return 0; return 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment