Skip to content

Instantly share code, notes, and snippets.

@hankliu5
Last active February 13, 2019 02:05
Show Gist options
  • Save hankliu5/cd28fdce678c036caf8f40f7c36c8171 to your computer and use it in GitHub Desktop.
Save hankliu5/cd28fdce678c036caf8f40f7c36c8171 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <string.h>
int main(void)
{
int a[3];
int b[3];
int i;
b[0] = 1;
printf("b[0] = %d\n",b[0]);
printf("address of b[0] = %p, address of a[4] = %p\n",&b[0], &a[4]);
a[4] = 12;
printf("b[0] = %d\n", b[0]);
for (i = 0; i < 5; i++)
{
printf("address of a[%d] = %p\n", i, &a[i]);
}
for (i = 0; i < 5; i++)
{
printf("address of b[%d] = %p\n", i, &b[i]);
}
a[3] = 5;
printf("a[3] = %d\n", a[3]);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment