Created
March 7, 2016 10:02
-
-
Save brianhsu/0f30faa7634cedff28c6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| void test(int x, void * userdata) { | |
| printf("x.value:%d\n", x); | |
| int * pointer = (int *) userdata; // userdata 指到的記憶體位置 | |
| printf("userdata.address:%d\n", pointer); | |
| int value = *pointer; // 取出這個位置實際存放的值 | |
| printf("userdata.value:%d\n", value); | |
| } | |
| void main() { | |
| int x = 10; | |
| int y = 20; | |
| test(x, &y); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment