fork(2) download
  1. #include <stdio.h>
  2.  
  3. struct metodoB {
  4. int teste;
  5. int exame;
  6. };
  7.  
  8. struct metodoA {
  9. int mt[6];
  10. int teste;
  11. int exame;
  12. } ;
  13.  
  14. typedef union {
  15. struct metodoA mA;
  16. struct metodoB mB;
  17. } Avaliacao;
  18.  
  19. typedef struct aluno {
  20. char nome[60];
  21. int numero;
  22. int metodo;
  23. Avaliacao av;
  24. } Aluno;
  25.  
  26. int main(void) {
  27. Aluno a = {.nome = "Luis", .numero = 57752, .metodo = 1,
  28. .av.mA.mt[0] = 0, .av.mA.mt[1] = 10, .av.mA.mt[2] = 100,
  29. .av.mA.mt[3] = 1000, .av.mA.mt[4] = 10000, .av.mA.mt[5] = 100000,
  30. .av.mA.teste = 42, .av.mA.exame = 2013};
  31. Aluno b = {.nome = "Nela", .numero = 58000, .metodo = 0,
  32. .av.mB.teste = -100, .av.mB.exame = 0};
  33. puts(&a != &b ? "OK" : "oops");
  34. }
Success #stdin #stdout 0s 1788KB
stdin
Standard input is empty
stdout
OK