fork download
  1. /******************************************************************************
  2.  
  3.   Online C Compiler.
  4.   Code, Compile, Run and Debug C program online.
  5. Write your code in this editor and press "Run" button to compile and execute it.
  6.  
  7. *******************************************************************************/
  8.  
  9. #include <stdlib.h>
  10. #include <stdio.h>
  11. #include <linux/types.h>
  12. #include <stdint.h>
  13. struct foo {
  14. void *bar;
  15. };
  16.  
  17. void test(struct foo *desc)
  18. {
  19. printf("value is:%u\n", *(uint32_t *)desc->bar);
  20. }
  21. int main(int argc, char **argv)
  22. {
  23. struct foo desc = {};
  24. uint32_t value = 5;
  25.  
  26. desc.bar = &value;
  27. test(&desc);
  28.  
  29. return 0;
  30. }
Success #stdin #stdout 0s 5288KB
stdin
123
stdout
value is:5