fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. #define example_two (*donttrythisathome)
  5.  
  6. int main(void) {
  7. unsigned char *tmp = calloc(100 * 2 * sizeof (float), 1);
  8.  
  9. float example_two[100][2] = tmp; // or you could use (void*)0xDEADBEEF
  10. example_two[42][0] = example_two[42][1] = -0.42;
  11. printf("2 * -0.42 = %f\n", example_two[42][0] + example_two[42][1]);
  12. printf("sizeof (float): %d\n", sizeof (float));
  13. printf("sizeof example_two: %d\n", (int)sizeof example_two);
  14. printf("sizeof example_two[0]: %d\n", (int)sizeof example_two[0]);
  15. printf("sizeof example_two[0][0]: %d\n", (int)sizeof example_two[0][0]);
  16.  
  17. free(tmp);
  18. return 0;
  19. }
  20.  
Success #stdin #stdout 0s 9424KB
stdin
Standard input is empty
stdout
2 * -0.42 = -0.840000
sizeof (float): 4
sizeof example_two: 800
sizeof example_two[0]: 8
sizeof example_two[0][0]: 4