Skip to main content

All Questions

1 vote
2 answers
131 views

linked list problem when displaying the list in C

having segmentation error while trying to access nodes i can create new nodes with my add function after function executes i cant access my nodes. i think they deallocated in memory but i couldnt ...
kuwira's user avatar
  • 15
-2 votes
2 answers
51 views

Why is this c linked list deletion at head program not printing the desired output?

// c program to delete first node.. // input size:3 // input elements:1,2,3 // desired output:2->3->NULL // actual output:1->NULL #include <stdio.h> #include <stdlib.h> struct ...
Hari Nivash R's user avatar
0 votes
2 answers
113 views

error: member access with misaligned address

I am working on problem 2 in leetcode (Two Sum) and I keep getting this error. I don't understand how this reflects what I wrote: here is my code that I wrote, I think it has something to do with the ...
Jerry Abu Ayoub's user avatar
1 vote
3 answers
128 views

Loop for Linked Lists

I really like this implementation of code but I don't want it to be hardcoded so can someone help me to make a loop for list = new_node(1); and so forth. #include <stdlib.h> #include <stdio.h&...
Grgi's user avatar
  • 35
0 votes
2 answers
51 views

Trying to delete node from a particular position . But I can only delete when in only input position 1 in the terminal

after running the code ,the program ask the position from where you want to delete a node . I ran the code but it only work when I input postion 1 .For other position like 2,3,4 it does not work . ...
DaVinci N's user avatar
0 votes
2 answers
185 views

Why this function is not able to reverse the Linked List?

I want to reverse a linked list but when i compile this code it terminates unexpectedly. #include <bits/stdc++.h> using namespace std; class node{ public: int data; node* next; ...
Saransh Kumar's user avatar
0 votes
1 answer
52 views

My linked list is giving segmentation faults after i delete an element and try to display my phone book

I'm trying to create a telephone directory and I'm having issues with my delete_pr function. the function's name itself explains what it is supposed to do pretty much. When I create a record using ...
ghadds's user avatar
  • 13
0 votes
1 answer
398 views

Getting the nth from last of the linked list

What I'm doing is that first I reversed the linked list and then actually I'm trying to get the nth value of a node. The problem is that the function isn't doing anything after it reverses the linked ...
Onesimus Chandra Pradhan's user avatar
0 votes
2 answers
136 views

How implement the removal of elements with even numbers from the created stack?

How implement the removal of elements with even numbers from the created stack? Here is the code. I'm not well versed in this topic yet. I ask for help. I need to implement the removal of elements ...
QWERTYU's user avatar
1 vote
1 answer
118 views

How to add a new node to a linked list alphabetically

I am trying to build a music library with five songs using a linked list, and each song has three tags, the songName, the Artist and the Genre. So I take users' input and add it to the linked list, ...
MLL's user avatar
  • 13
-1 votes
5 answers
1k views

accessing struct members using pointer to pointer

I have a program like below, when I try to access a struct member using pointer to pointer it says the expression must have a pointer to class type. Please tell me how can I access data element of the ...
logeeks's user avatar
  • 4,963
1 vote
2 answers
1k views

Function to insert a node in a linked list in C

I'm trying to learn data structures in C and I'm stuck at the first function I made. If I run this nothing happens. I get no errors but the program doesn't print anything. #include <stdio.h> #...
StevieG25's user avatar
0 votes
1 answer
82 views

(C) Inserting into a Linked List struct is not reflecting within other functions

I am attempting to insert nodes into the head of a Linked List object, but the updated head does not appear to reflect in other functions. My professor has dictated that our insert functions need a ...
QuantumBlink's user avatar
1 vote
1 answer
578 views

Deleting all nodes smaller than x in singly linked list in c

I making a program that the lets the user enter countless integers until the number 0 is entered, then display and sort it from smallest to largest. Code: #include <stdio.h> #include <stdlib....
Taha Hagar's user avatar
1 vote
2 answers
375 views

Leetcode:Merge Two Sorted Lists. I don't know where the link is wrong

I would like to ask why this link list will not run the result. After running, it is TLE. I want the head to be an indicator, and the head list can be returned without modifying the head. /** * ...
周志桓's user avatar

15 30 50 per page