Skip to content

Instantly share code, notes, and snippets.

@rye761
Last active August 17, 2016 04:51
Show Gist options
  • Save rye761/1cc159d6384e6f3a266bc59505d33b8c to your computer and use it in GitHub Desktop.
Save rye761/1cc159d6384e6f3a266bc59505d33b8c to your computer and use it in GitHub Desktop.
Not sure why this doesn't cause an error.
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char const *argv[]) {
int *my_array = malloc(sizeof(int));
my_array[0] = 3;
my_array[1] = 4;
printf("%d, %d\n", my_array[0], my_array[1]);
free(my_array);
return 0;
}
/* Produces: 3, 4. */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment