You need
malloc (size*sizeof(int))
instead of
malloc (size*sizeof(uint8_t))
or maybe you need
uint8_t* buffer = malloc (size*sizeof(uint8_t));
It depends if you want a buffer of 10 int
of a buffer of 10 uint8_t
.
For printing the content of the buffer use:
for (i = 0; i < size; i++)
{
printf("%d\n", buffer[i]) ;
}
Following line only prints the address of the buffer.
printf("Content of buffer = %d\n", buffer);