Hello, Im tring to pass a pointer and assign its memory dynamically within the function. Can Someone tell me why my problem says i isnt being initalized when I pass it? And why it isnt dynamically allocating any memory. Thanks
Thanks for looking at my question.Code:#include <iostream>
#include <string>
using namespace std;
void f(int *p){
p=new int;
}
int main(){
int *i;
f(i);
system("PAUSE");
return 0;
}
Take care.
And Merry Post Christmas.