Advertisement
dmi3on

Untitled

Apr 17th, 2014
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.41 KB | None | 0 0
  1.  
  2.     struct date {
  3.         char day[80];
  4.         int month;
  5.         int year;
  6.     };
  7.  
  8.     //Error a value of type "void*" cannot be used to initialize an entity of type "date*"
  9.     struct date *object=malloc(sizeof(struct date));
  10.     strcpy(object->day,"Good day");
  11.     object->month=6;
  12.     object->year=2013;
  13.     FILE * file= fopen("output", "wb");
  14.  
  15.     if (file != NULL) {
  16.         fwrite(object, sizeof(struct date), 1, file);
  17.         fclose(file);
  18.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement