fork download
  1. #include <stdio.h>
  2.  
  3. typedef struct
  4. {
  5. int x;
  6. const char* str;
  7. } T;
  8.  
  9. void fxn2(T* t)
  10. {
  11. t->x++;
  12. t->str++;
  13. }
  14.  
  15. int main(void)
  16. {
  17. T t1 = { 1, "XYZ" };
  18. printf("t1: %d, %s\n", t1.x, t1.str);
  19. fxn2(&t1);
  20. printf("t1: %d, %s\n", t1.x, t1.str);
  21. return 0;
  22. }
  23.  
Success #stdin #stdout 0.01s 1676KB
stdin
Standard input is empty
stdout
t1: 1, XYZ
t1: 2, YZ