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. typedef struct{
  8. int AnInt;
  9. float AFloat;
  10. } myStruct;
  11. // make an instance of myStruct called M using the typedef
  12. myStruct M;
  13. // fill its fields and print them
  14. M.AnInt = 1;
  15. M.AFloat = 1.2f;
  16. printf ("M has values:\n AnInt=%d\n AFloat=%f\n",
  17. M.AnInt, M.AFloat);
  18. return 0;
  19. }
Success #stdin #stdout 0s 5324KB
stdin
Standard input is empty
stdout
M has values:
 AnInt=1
 AFloat=1.200000