Skip to content

Instantly share code, notes, and snippets.

@danish-rehman
Created June 8, 2015 02:19
Show Gist options
  • Save danish-rehman/6f1a1ac1b63aead33c62 to your computer and use it in GitHub Desktop.
Save danish-rehman/6f1a1ac1b63aead33c62 to your computer and use it in GitHub Desktop.
Simple_mail_struct
/* Inefficient way */
struct email {
time_t send_date;
int flags;
int length;
char body[EMAIL_BODY_MAX];
};
struct email *email = malloc (sizeof (struct email));
/* This size is fixed and not dependent on the caller */
email->length = 12 + EMAIL+BODY_MAX;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment