Skip to content

Instantly share code, notes, and snippets.

@milesegan
Created March 19, 2011 23:20
Show Gist options
  • Save milesegan/877898 to your computer and use it in GitHub Desktop.
Save milesegan/877898 to your computer and use it in GitHub Desktop.
c99 variable-length array example
// the old way:
int calculate_z(int a, int b)
{
int *buffer = malloc(a * sizeof(int));
// ...
free(buffer);
}
// the new way:
int calculate_z(int a, int b)
{
int buffer[a];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment