Skip to main content

All Questions

0 votes
2 answers
95 views

How to dynamically create multiple instances of struct in loop in C? [duplicate]

I have the following code to create one-way list of user-specified number of elements typedef struct Node{ int val; struct * Node next; } Node; int main(){ int num; Node * prev = NULL;...
user98967885655's user avatar
-1 votes
1 answer
48 views

how to make a linked list with template

i have problems with distributing template. i tried with different syntax, but not a successful way with the error text: error C2512: 'node': no appropriate default constructor available for the code ...
Mohamed Elhaware's user avatar
0 votes
1 answer
97 views

Why the structure pointer "p" in the following code is not updating with the "temp" value assigned to it? [duplicate]

#include <stdio.h> #include <stdlib.h> struct node { int data; struct node *link; }; int main(int argc, char *argv[]) { struct node *p; p = NULL; Append(&...
AVINASH BHARTI's user avatar
3 votes
2 answers
871 views

ntdll!RtlIsZeroMemory releasing linked list memory in C [warning: Critical error detected c0000374]

I am trying to write data with a linked list structure. After writing the function used to apply memory for each node in the linked list, I started writing the function used to release memory for each ...
S-N's user avatar
  • 360
1 vote
1 answer
79 views

Stacks & Dynamic memory in C

Exercise: Read a line from the user and print the words in reverse order. Considering the nature of the problem I implemented a singly linked list, to store the words, then copied from the head of the ...
stfp04's user avatar
  • 59
0 votes
1 answer
85 views

C++ Linked List find() sharing nodes between two linked list

I have two structs Invoice & InvoiceDetails defined as follow: struct InvoiceDetails { int invoiceId; int productId; int price; int quantity; }; struct Invoice { int id; ...
chinhpc's user avatar
  • 13
0 votes
0 answers
53 views

Memory allocation for different type of singly list nodes in C

I am in the process of building a linked list for later use. Basic singly direction list, defined like so: typedef struct { char *name; char *content; } first_type; typedef struct { char *...
Biran's user avatar
  • 1
0 votes
3 answers
92 views

Problem with free in language C which doesn't work

I wrote this program and I want to free a structure myStruct but it doesn't compile it says: free():double free detected in tcache2 Can you help me please ? #include <stdio.h> #include <...
lilo's user avatar
  • 11
0 votes
1 answer
44 views

not being able to delete the first node in a linked list

#include <stdio.h> #include <stdlib.h> #define N 10 typedef struct music_student *StudentPtr; typedef struct music_student { int student_ID; double hw_average; int exam_grade; ...
hsn saed's user avatar
-2 votes
3 answers
65 views

node pointer of a list wont update

I had a problem and I cannot seem to find a solution.I tried to do a simple program that creates a list and prints it in C, but when i tried to run it it looped printing the first value of the list....
Jaco Toffo's user avatar
0 votes
1 answer
55 views

C linked list printing extra 0 at the beginning

this program is not completely ready yet, so not all funcionalities are coded. However, I am facing a problem when it comes to the very basic functionality: adding the node in the end of the linked ...
cosman's user avatar
  • 17
2 votes
2 answers
48 views

Changing the variable assigned as a pointer to the parameter in C

Firstly I'm using C language. I want a variable that I refer to as a parameter to change outside the function when it is changed inside the function. But the problem is that the variable is of type ...
Kaan Yılmaz's user avatar
-1 votes
1 answer
539 views

How to properly allocate memory for linked list in C inside function?

I have spent several hours trying to initialize linked list with, say, integer values from 0 to 10. I create pointer of struct node and pass its reference to function init_ll. The init_ll function ...
Konstantin Konov's user avatar
0 votes
1 answer
321 views

C++ LinkedList implemantation, why insert function creates node with new keyword, why is it dynamically allocated?

I'm working with LinkedLists from custom node, I'm still struggling to understand some concepts. For simplicity functions are reduced class Node { public: T data; Node* next; Node(...
theanonymous's user avatar
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 { ...
mariekart42's user avatar

15 30 50 per page