Skip to main content

All Questions

1 vote
1 answer
65 views

How can I display only the first 10 inputs from the list?

I'm inserting in a list of struct some details that each fourplet represents a packet with source, destination, generation time and a rollnumber? Here is my display function and in the main() I just ...
wajaap's user avatar
  • 269
1 vote
1 answer
123 views

How to find the most common element in a custom linked list implementation?

I'm trying to make my own non-STL linked list implementation. I tried to write a function to find the most common element and print which one it is and how many times we encounter it in the list. I'...
KucheKajiMyau's user avatar
0 votes
2 answers
290 views

Copy a pointer to a struct in a function (linked list)

I want to craete a single linked list without gloabal variables. I initialized the first element with NULL and then wanted to copy the first element node to list_. It is copied in the function but the ...
langung's user avatar
0 votes
1 answer
35 views

What does mean this section of Remove List Node in C mean

Below is the complete code to Delete the last Node of a linked simple List and if it works well The function is void deleteLastNode (). But exactly what does this part mean? It seems to me to spare ...
user_new2017's user avatar
0 votes
2 answers
219 views

Why does malloc keep giving a "incompatible types" error when assigning memory even though both the pointer and the typecasting are of correct type [closed]

void createLL(int A[], struct Node *a) { struct Node* b, temp; a->data = A[0]; a->next = NULL; b=a; for(int i=1;i < SIZE;i++) { temp = (struct Node*)...
Swaraj Kausik's user avatar
-1 votes
1 answer
43 views

Problems during the creation of a list

When I execute the code it doesn't print the list, so adding the IF inside of the Lread function I discovered that *list is still NULL when I read it! Can you tell me why the Lcreate function fail to ...
Alessandro's user avatar
-2 votes
2 answers
88 views

Deleting duplicate elements in a list in c++ [closed]

I have a task to delete any duplicate elements from a list. I am using a struct and pointers for my functions. Here is the struct and the function: struct node { int key; node *next; }*...
rollstapewz's user avatar
1 vote
2 answers
82 views

How can I get a 0 on the output?

So I'm working with the type: typedef struct lligada { int valor; struct lligada *prox; } *LInt; And I'm trying to do a function that takes a LInt (ordered) and eliminate the repeated ones, ...
Bruno's user avatar
  • 53
0 votes
1 answer
81 views

can't remove first node from linked list

today i had C exam, and i could't manage to remove first node from the linked list. In my case, it delets the first element, but head is still pointing to a first node '0'. I am sitting right now and ...
hghtms's user avatar
  • 1
-3 votes
3 answers
76 views

Can't create a list of structs

#include <stdio.h> #include <stdlib.h> struct data { int x; struct data *next; }; typedef struct data d_t; /* Main fuction */ int main(){ int x; d_t test , *root , *...
Konstantinos Tsirakos's user avatar