fork download
  1. #include<stdio.h>
  2.  
  3. typedef struct {
  4. char str[100];
  5. int modify_index;
  6. char modify_ch;
  7. } DATA;
  8.  
  9. void abc(DATA * dt)
  10. {
  11. dt->str[dt->modify_index] = dt->modify_ch;
  12. }
  13.  
  14. int main(void)
  15. {
  16. DATA d;
  17.  
  18. for (d.modify_index = 0; d.modify_index <= 7; d.modify_index++) {
  19. d.modify_ch = '0' + d.modify_index;
  20. abc(&d);
  21. }
  22. d.modify_ch = '\0';
  23. abc(&d);
  24. printf("str = %s\n", d.str);
  25.  
  26. return 0;
  27. }
  28.  
Success #stdin #stdout 0s 1832KB
stdin
Standard input is empty
stdout
str = 01234567