Created
February 23, 2015 07:51
-
-
Save kaneshin/594639a55a98db879dfe 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> | |
| #include <stdlib.h> | |
| struct Some { | |
| int *num; | |
| }; | |
| struct Some * | |
| alloc_some(int n) { | |
| struct Some *some = (struct Some *)malloc(n * sizeof(struct Some)); | |
| some->num = (int *)malloc(sizeof(int)); | |
| return some; | |
| } | |
| int | |
| main(int argc, char* argv[]) | |
| { | |
| struct Some *some = (struct Some *)malloc(sizeof(struct Some)); | |
| printf("%x\n", some); | |
| printf("%x\n", some->num); | |
| struct Some *foo = alloc_some(1); | |
| printf("%x\n", foo); | |
| printf("%x\n", foo->num); | |
| return 0; | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
40404ba0
0
40404bb0
40404bc0