fork download
  1. #include <stdint.h>
  2. #include <stdio.h>
  3.  
  4. struct cRGB
  5. {
  6. uint8_t g;
  7. uint8_t r;
  8. uint8_t b;
  9. };
  10.  
  11. struct cRGB blubb(void)
  12. {
  13. return (struct cRGB){12,34,56};
  14. }
  15.  
  16. struct cRGB blubb2(void)
  17. {
  18. struct cRGB foo;
  19. foo.g = 99;
  20. foo.r = 99;
  21. foo.b = 99;
  22. return foo;
  23. }
  24.  
  25. void gnoerps(struct cRGB* p)
  26. {
  27. p->g = 77;
  28. p->r = 88;
  29. p->b = 99;
  30. }
  31.  
  32. int main(void)
  33. {
  34. struct cRGB farbe = blubb();
  35. printf("blubb: ( %u | %u | %u )\n", farbe.g, farbe.r, farbe.b);
  36. farbe = blubb2();
  37. printf("blubb2: ( %u | %u | %u )\n", farbe.g, farbe.r, farbe.b);
  38. gnoerps(&farbe);
  39. printf("gnoerps: ( %u | %u | %u )\n", farbe.g, farbe.r, farbe.b);
  40. }
  41.  
Success #stdin #stdout 0s 2160KB
stdin
Standard input is empty
stdout
blubb:   ( 12 | 34 | 56 )
blubb2:  ( 99 | 99 | 99 )
gnoerps: ( 77 | 88 | 99 )