fork download
  1. #include <stdio.h>
  2.  
  3. void f(size_t n, const char a[][n], char *x, int i)
  4. {
  5. struct {char m[n];} *f = (void*)a[i], *t = (void*)x;
  6. *t = *f;
  7. }
  8.  
  9. enum {N=20};
  10. int main()
  11. {
  12. char a[][N]={"null","eins","zwei","drei"};
  13. char x0[N]="",x1[N]="",x2[N]="",x3[N]="";
  14. puts("=====");
  15. puts(x0);
  16. puts(x1);
  17. puts(x2);
  18. puts(x3);
  19. puts("=====");
  20.  
  21. f(N,a,x1,1);
  22. f(N,a,x2,2);
  23.  
  24. puts(x0);
  25. puts(x1);
  26. puts(x2);
  27. puts(x3);
  28. puts("=====");
  29.  
  30. return 0;
  31. }
  32.  
Success #stdin #stdout 0s 4360KB
stdin
Standard input is empty
stdout
=====




=====

eins
zwei

=====