I have a segmentation fault in the code below, but after I changed it to pointer to pointer, it is fine. Could anybody give me any reason?
void memory(int *
i corrected the code.. read the comment and all will be clear..
#include #include #include using namespace std; void memory(int* p, int size) { //pointer to pointer` not needed try{ p = new int[size] ; } catch(bad_alloc &e) { cout<