ifstream* Segmentation fault [closed]

In your code, i is a pointer and it is not initialized, so the memory location it points to is indeterminate.

Next, you are attempting to dereference it in (*i)....., which, invokes undefined behavior.

You need to allocate memory (i.e., make the pointer point to some valid memory location) before you can dereference the pointer.

Leave a Comment