fwrite - Count number of objects in C

  #include <stdio.h>
  #include <stdlib.h>

  int main(void)
  {
    FILE *fp;
    float f=12.23;

    if((fp=fopen("test", "wb"))==NULL) {
      printf("Cannot open file.\n");
      exit(1);
    }

    fwrite(&f, sizeof(float), 1, fp);

    fclose(fp);

    return 0;
  }