Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7907745
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T11:36:39+00:00 2026-06-03T11:36:39+00:00

I wrote this code,and I’d like to know whats my problem, if u can

  • 0

I wrote this code,and I’d like to know whats my problem, if u can help me fix my code insted of writting one of ur own, it’d help me a lot…
Edit: I’ve changed it to this, and now it doesnt give me a run time error, but when I print the name, or check if the node exists, it says it is…

void node_delete(friend *amit) // Deleting a node
{
 friend* temp;
 int flag = 0;
 while (head != NULL) // As long the node isnt the last one
 {
       if (0 == (strcmp(head -> next -> name, amit -> name))) // If the name that the user entered matchs a name in the linked list,
       { // It'll skip it
            temp = head -> next;
             head -> next = head -> next -> next; // Deletes a node from the linked list
             flag = 1;
       }
       if (flag == 1) break;
       head = head -> next; // Going to the next node
}
 free(temp); // Freeing the deleted node
 printf ("%s\n", amit -> name);
}

and in the main :

amit.name = "amit"
amit.age = 16
amit.gender = 'm'
node_delete(&amit);

and the struct define:

typedef struct friend // The struct
 {
   char *name; 
   int age;
   char gender; 
   struct friend* next; // A pointer that points to the next node in the linked list
}friend;

Thanks a lot 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T11:36:40+00:00Added an answer on June 3, 2026 at 11:36 am

    Here are some comments for the first few lines:

     head = amit;
     head -> next = amit;  // same as amit->next = amit;
     amit -> next = NULL;  // same as head->next = null;
     while (head -> next != NULL) // will never do anything since head->next is null
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wrote this code and there is a problem that I can't seem to
I wrote this code in order to make a soundboard like app public class
I wrote this code because I'm having a similar problem in a larger program
I wrote this code but its not displaying the images someone know how to
I wrote this code. It's really ugly. I would like to refactor it. I
I wrote this code which is working but it made me start thinking how
I wrote this code to scrape a sparse array from a series of dom
I wrote this code and it works, but I'm still wondering if there is
I wrote this code in C# to encrypt a string with a key: private
I wrote this code. The constructor works normally, but in the destructor I get

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.