/** * Writing an array of structures using fwrite * @author gtowell * Created: April 2021 * **/ #include #include #define SIZ 100 typedef struct { int aa; double bb; } aabb; int main(int argc, char const *argv[]) { aabb arr[SIZ]; for (int i = 0; i < SIZ; i++) { arr[i].aa = i; arr[i].bb = sqrt(i); } FILE *fp = fopen("astr", "w"); fwrite(arr, sizeof(aabb), SIZ, fp); fclose(fp); return 0; }