fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <limits.h> // UINT_MAX를 사용하기 위해 필요
  4.  
  5. struct dmz_mblock {
  6. void *hybrid_data;
  7. };
  8.  
  9. struct hybrid_map {
  10. unsigned int hybrid_zone_id;
  11. unsigned int chunk_index[32768];
  12. };
  13.  
  14. int main(void) {
  15. struct dmz_mblock *dmz_mblk = malloc(sizeof(struct dmz_mblock));
  16. if (!dmz_mblk) {
  17. printf("Failed to allocate memory for dmz_mblk\n");
  18. return -1;
  19. }
  20.  
  21. struct hybrid_map *hmap = malloc(sizeof(struct hybrid_map));
  22. hmap = (struct hybrid_map *) dmz_mblk->hybrid_data;
  23.  
  24.  
  25. printf("sizeof dmz_mblk->hybrid_data: %u, hmap: %u\n", sizeof(dmz_mblk->hybrid_data), sizeof(hmap));
  26.  
  27.  
  28.  
  29.  
  30. return 0;
  31. }
  32.  
Success #stdin #stdout 0s 5292KB
stdin
Standard input is empty
stdout
sizeof dmz_mblk->hybrid_data: 8, hmap: 8