Quantcast
Channel: Segmentation Fault, pointer issue? - Stack Overflow
Browsing all 3 articles
Browse latest View live

Answer by Jabberwocky for Segmentation Fault, pointer issue?

This will cause a segfault because you are dereferencing a pointer that has not been initialized. int *x; // declares pointer X *x = 3; // seg fault here because x contains garbage and points certainly...

View Article


Answer by HelloWorld123456789 for Segmentation Fault, pointer issue?

In main you have to allocate spaces for x and y before you can use it. If x and y are not allocated spaces, they point to arbitrary memory locations. If they are outside of your program segment, you...

View Article

Segmentation Fault, pointer issue?

I'm pretty new to C coding, and pointers are something I'm having a lot of trouble with. I'm trying to write a program that takes in 2 pointers as parameters, adds the value of the first to the second,...

View Article
Browsing all 3 articles
Browse latest View live