Skip to content

Instantly share code, notes, and snippets.

@AndyNovo
Created October 5, 2016 16:00
Show Gist options
  • Save AndyNovo/2e30f1147c68cae4bbcf921b6c176aa7 to your computer and use it in GitHub Desktop.
Save AndyNovo/2e30f1147c68cae4bbcf921b6c176aa7 to your computer and use it in GitHub Desktop.
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv) {
size_t bytes = 1;
int* p2chunk = (int *) malloc(bytes);
printf("%p p2chunk\n", (void*)p2chunk);
p2chunk[0] = 1;
p2chunk[1] = 2;
p2chunk[2] = 3;
p2chunk[3] = 4;
printf("%d %d %d %d\n", p2chunk[0], p2chunk[1], p2chunk[2], p2chunk[3]);
free(p2chunk);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment