fork download
  1. #include <stdio.h>
  2.  
  3. typedef struct
  4. {
  5. int value;
  6. } MyStruct;
  7.  
  8. int passByConstPointerConst(MyStruct const * const myStruct)
  9. {
  10. return printf("%s: %p\n", __func__, (void *) myStruct);
  11. }
  12.  
  13. int passByValueConst(MyStruct const myStruct)
  14. {
  15. return printf("%s: %p\n", __func__, (void *) &myStruct);
  16. }
  17.  
  18. int main(void)
  19. {
  20. MyStruct myStruct = {.value = 5};
  21.  
  22. printf("%s: %p\n", __func__, (void *) &myStruct);
  23. passByConstPointerConst(&myStruct);
  24. passByValueConst(myStruct);
  25.  
  26. return 0;
  27. }
  28.  
Success #stdin #stdout 0.02s 1676KB
stdin
Standard input is empty
stdout
main: 0xbfb9b764
passByConstPointerConst: 0xbfb9b764
passByValueConst: 0xbfb9b740