fork(1) download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. typedef struct {
  5. int i;
  6. } Tipo;
  7.  
  8. int main() {
  9. Tipo x = { .i = 10 };
  10. printf("%d", x.i);
  11. int y = x.i;
  12. printf("%d", y);
  13. Tipo *z = (Tipo *)malloc(sizeof(Tipo)); //C++ exige o cast
  14. z->i = 10;
  15. printf("%d", z->i);
  16. y = z->i;
  17. printf("%d", y);
  18. }
  19.  
  20. //http://pt.stackoverflow.com/q/183066/101
Success #stdin #stdout 0s 2300KB
stdin
Standard input is empty
stdout
10101010