irishScott
Lifer
And I thought picking up C++ from Java would be easy, until I ran into pointers 😛
Anyways, here's the empirical problem code:
int main(void)
{
int* i3 = new int;
*i3 = 25;
someFunction(i3);
}
someFunction(int* i)
{
cout << *i; //works. Prints 25;
int x = (*i); /*Apparently causes a seg fault. When I comment it out, the seg fault doesn't occur. I also tried making a pointer and assigning it's value to *i (ie: *newPointer = *i), but that had the same result. Google is useless. Any ideas? */
}
Anyways, here's the empirical problem code:
int main(void)
{
int* i3 = new int;
*i3 = 25;
someFunction(i3);
}
someFunction(int* i)
{
cout << *i; //works. Prints 25;
int x = (*i); /*Apparently causes a seg fault. When I comment it out, the seg fault doesn't occur. I also tried making a pointer and assigning it's value to *i (ie: *newPointer = *i), but that had the same result. Google is useless. Any ideas? */
}