Skip to content

Instantly share code, notes, and snippets.

@renaudcerrato
Created January 21, 2019 08:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save renaudcerrato/b183ce7cbd92782caa5f1f8f0ffaba8d to your computer and use it in GitHub Desktop.
Save renaudcerrato/b183ce7cbd92782caa5f1f8f0ffaba8d to your computer and use it in GitHub Desktop.
Zero Length Arrays
struct pstring {
unsigned length;
char content[0];
};
struct pstring my_string = (struct pstring *) malloc(sizeof (struct pstring) + my_length);
mystring->length = my_length;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment