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 8001289
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T16:03:23+00:00 2026-06-04T16:03:23+00:00

int id_swap() { char tempstring[15]; strcpy(tempstring, id[index+1]); strcpy(id[index+1], id[index]); strcpy(id[index], tempstring); } int delete_student()

  • 0
int id_swap()
{
    char tempstring[15];

    strcpy(tempstring, id[index+1]);
    strcpy(id[index+1], id[index]);
    strcpy(id[index], tempstring);
}

int delete_student()
{
    int found=0;
    char id_to_find[10];

    printf("Please enter the student ID to delete\n\n");
    scanf("%s", & id_to_find);
    fflush(stdin);
    system("cls");

    for(index=0;index<height_of_array+1;index++)
    {
        if(strcmpi(id_to_find, id[index]) == 0)
        {
            found=1;
            id_swap();
            system("cls");
            printf("Student deleted");
            height_of_array = height_of_array--;
        }

Okay so that’s part of my code. A quick example of what happens

I sort the students that are already in the program so it comes up like this for e.g

Student#1 Chris ID: 1831
Student#2 etc
student#3 etc
student#4 Brian ID: 4432
student#5 etc
student#6 etc

But when I try to delete say Brian for example, it deletes it but then it looks like this

student#1 ID:
Student#2 Chris ID:1831
Student#3 etc

Is there any way to move that blank array to the last position so I can then decrement my “Height_of_array” so that the number of storable students goes down by 1 to reflect the deletion

  • 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-04T16:03:25+00:00Added an answer on June 4, 2026 at 4:03 pm

    There are a few problems with your code: that jump at me:

     fflush(stdin);
    

    Never do that. Only flush output streams.

    height_of_array = height_of_array--;
    

    Is undefined behavior, you meant:

    height_of_array--;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

class Student { int id; string name; public Student(int id, string name) { this.id
int id = ((reply[0] & 0x3)); id = (id<<7) | (reply[1] & 0x7F); Suppose
My Controller Action accepts int id. What to do when calling from View ActionLink
struct node { int id; float weight; }; int find_last(struct node Prio_Q[]) { int
I have the following two tables: Customer { int Id int Name } Bills
I have this code: class MyObj { int Id; string Name; string Location; }
i have 2 actions public ActionResult FilesAdd(int id) { FillParentMenuDDL(id); return View(); } [HttpPost]
Assuming public class MyClass { public int ID {get; set; } public string Name
I have a struct typedef struct { int id; string name; string address; string
public class News { public virtual int Id { set; get; } public virtual

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.