All Questions
133 questions
-1
votes
4
answers
94
views
Incompatible pointer types when declaring a struct [duplicate]
list.h: In function ‘CreateNewLinks’:
list.h:29:20: warning: assignment to ‘numbers *’ from incompatible pointer type ‘struct numbers *’ [-Wincompatible-pointer-types]
29 | linked = ...
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 ...
0
votes
2
answers
97
views
Deleting and inserting nodes in a linked list behave differently (?)
I'm trying to learn linked lists from King (2008) "C Programming: A Modern Approach", 2nd ed and I'm puzzled by the behaviour of the deletion operation as compared to the insertion operation....
-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 ...
0
votes
1
answer
28
views
struct that holds struct, how to dereference
i have couple of linked lists in my larger program which i now want to keep in a struct (t_holder).
typedef struct s_list
{
int val;
struct t_list *next;
} t_list;
typedef struct s_holder
{
...
1
vote
1
answer
89
views
Issue with a first-class linked list implementation in C
I am a newbie at programming at C and I am learning from a book so I apologize if the following is too basic. I am trying to implement first-class linked lists and the following program when executed ...
-1
votes
1
answer
523
views
Error in a simple program of entering elements at beginning of a linkedlist and displaying it in c programming
This is my code for program to enter elements in beginning of a linked list and print the linked list which is working perfectly fine(i am getting correct output for it) -
#include <stdio.h>
#...
0
votes
0
answers
64
views
Segmentation fault in C program and stops running further
I am trying to run a link list program in C using Visual Code but after running it, it is giving me a segmentation fault error.
Additionally, it gets stopped on running code.
Code:
#include<stdlib....
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&...
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 .
...
-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 ...
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>
#...
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 ...
0
votes
1
answer
3k
views
C program to traverse a singly linked list
I have written a C program to implement the concept of traversing a singly linked list. The program first creats the list by asking for the user input and then displays/ traverses through the created ...
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....