Quote:
A segmentation fault occurs when a program attempts to access a memory location that it is not allowed to access, or attempts to access a memory location in a way that is not allowed (for example, attempting to write to a read-only location, or to overwrite part of the operating system).
On Unix-like operating systems, a signal called SIGSEGV is sent to a process that accesses an invalid memory address.
For some details on
Segmentation Fault[
^].
Your case, most likely, your ptr_list does not have a valid value. Your queue setup looks incorrect and I am not sure if how is your Node defined (should be defined if you are getting some output).
In C, it is not the correct setup - you need to add struct keyword before the pointers for connecting them:
struct Node {
int data;
struct Node* next;
};
Would suggest to read and learn about linked list.
Refer:
Linked List Program in C - Tutorialspoint[
^]
Linked List | Set 1 (Introduction) - GeeksforGeeks[
^]