fork(2) download
  1. #include <stdio.h>
  2.  
  3. struct starship {
  4. char * name;
  5. char * type;
  6. int numphasers;
  7. int numphotontorps;
  8. int crewsize;
  9. };
  10.  
  11. struct fleet {
  12. char * name;
  13. struct starship ships[100];
  14. };
  15.  
  16. struct fleet fleets[10];
  17.  
  18. int main (int argc, char * args[]) {
  19. struct starship enterprise = {"Enterprise D", "NCC 1701", 5, 25, 428 };
  20. fleets[0].name="First fleet";
  21. fleets[0].ships[0]= enterprise;
  22.  
  23. printf("Ship's type is %s",fleets[0].ships[0].type);
  24. return 0;
  25. }
Success #stdin #stdout 0.01s 10192KB
stdin
Standard input is empty
stdout
Ship's type is NCC 1701