Allocating memory inside a function and returning it back
- by user2651062
I want to pass a pointer to my function and allocate the memory to which this pointer points. I've read in other posts that I should pass a double pointer to this function and I did so, but I keep getting segmentation fault:
#include <iostream>
#include <stdlib.h>
using namespace std;
void allocate(unsigned char** t)
{
…