fork download
  1. #include <stdio.h>
  2.  
  3. typedef struct
  4. {
  5. int i;
  6. float a;
  7. char c;
  8. char *str;
  9. } my_struct_t;
  10.  
  11. int main()
  12. {
  13. my_struct_t struct_t;
  14.  
  15. struct_t.i = 10;
  16. struct_t.a = 1.0f;
  17. struct_t.c = 'a';
  18. struct_t.str = "hello";
  19.  
  20. FILE *file = NULL;
  21.  
  22. file = fopen("test", "w" );
  23. if( file )
  24. {
  25. fprintf( file, "%d %f %c %s", struct_t.i, struct_t.a, struct_t.c, struct_t.str );
  26. fclose( file );
  27. }
  28. else
  29. {
  30. printf("Error!");
  31. fclose(file);
  32. }
  33. return 0;
  34. }
Runtime error #stdin #stdout 0s 3428KB
stdin
Standard input is empty
stdout
Standard output is empty