fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main ()
  5. {
  6. // myStruct is a type that has 2 fields
  7. struct myStruct{
  8. int AnInt;
  9. float AFloat;
  10.  
  11. };
  12. // create an alias named myStructType from the old name "struct myStruct"
  13. typedef struct myStruct myStructType;
  14. // make an instance of myStruct called M using the typedef
  15. myStructType M;
  16. // fill in its fields and print them
  17. M.AnInt = 1;
  18. M.AFloat = 1.2f;
  19. printf ("M has values:\n AnInt=%d\n AFloat=%f\n",
  20. M.AnInt, M.AFloat);
  21. return 0;
  22. }
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
M has values:
 AnInt=1
 AFloat=1.200000