Skip to content

Instantly share code, notes, and snippets.

@cengiz-io
Last active August 29, 2015 14:11
Show Gist options
  • Save cengiz-io/ebfb579069aae32e5c66 to your computer and use it in GitHub Desktop.
Save cengiz-io/ebfb579069aae32e5c66 to your computer and use it in GitHub Desktop.
int main() {
int *x[10];
int (*y)[10];
int val = 666;
for (int a = 0; a < 10; a++) {
x[a] = &val;
(*y)[a] = val;
}
return 0;
}
/*
(lldb) print x
(int *[10]) $1 = {
[0] = 0x00007fff5fbff764
[1] = 0x00007fff5fbff764
[2] = 0x00007fff5fbff764
[3] = 0x00007fff5fbff764
[4] = 0x00007fff5fbff764
[5] = 0x00007fff5fbff764
[6] = 0x00007fff5fbff764
[7] = 0x00007fff5fbff764
[8] = 0x00007fff5fbff764
[9] = 0x00007fff5fbff764
}
(lldb) print *x
(int *) $2 = 0x00007fff5fbff764
(lldb) print *x[0]
(int) $3 = 666
(lldb) print *(x[0])
(int) $4 = 666
(lldb) print *(x[1])
(int) $5 = 666
(lldb) print y
(int (*)[10]) $6 = 0x00007fff5fbff8e8
(lldb) print *y
(int [10]) $7 = (
[0] = 666,
[1] = 666,
[2] = 666,
[3] = 666,
[4] = 666,
[5] = 666,
[6] = 666,
[7] = 666,
[8] = 666,
[9] = 666
)
(lldb) print *y[0]
(int) $8 = 666
(lldb) print *(y[0])
(int) $9 = 666
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment