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. // make an instance of myStruct called M
  13. struct myStruct M;
  14. // fill in fields and print them
  15. M.AnInt = 1;
  16. M.AFloat = 1.2f;
  17. printf ("M has values:\n AnInt=%d\n AFloat=%f\n",
  18. M.AnInt, M.AFloat);
  19. return 0;
  20. }
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
M has values:
 AnInt=1
 AFloat=1.200000