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

  • Home
  • SEARCH
  • 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 907249
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T16:31:27+00:00 2026-05-15T16:31:27+00:00

I am having two minor problems in this code but i am unable to

  • 0

I am having two minor problems in this code but i am unable to get them. i have mentioned on the places the compiler is giving error.There are two of them given below:

#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#define SIZE 100
int count;

void menu(void);
void input(int[]);
void print(int[]);
void insert(int[]);
void delete_element(int arr[]);
void search(int arr[]);

void main(void)
{
  int arr[SIZE];
  char choice;
  while(1)
  {
    menu();
    choice=getche();
    switch (choice)
    {
      case'1':input(arr);break;
      case'2':delete_element(arr);break;
      case'3':insert(arr);break;
      case'4':print(arr);break;
      case'5':search(arr);break;
      case'6':exit(0);//from stdlib.h
      default:printf("Enter valid choice!");
    }

    getch();
  }

void print(int arr[])
{    // says declaration syntax error here
  int i;
  for(i=0;i<count ;i++)
    printf("element is %d",arr[i]);

}

void input(int arr[])
{
  if(count<SIZE)
    for(count=0; ;count++)
    {
      printf("Enter element %d:",i+1);
      scanf("%d"&arr[i]);
      if(arr[count]==0)
      {
        count--;
        break;
      }
    }
}

void insert(int arr[])
{
  int i,value,index;
  if(count==SIZE)
    printf("Not enough space to perform insertion");
  else
  {
    printf("Enter value and index:");
    scanf("%d",&value,&index);
    for(i=index;i<=LEN;i++)
    {
      arr[i]=arr[i-1];
    }
    arr[index]=value;
    count++;
    printf("insertion succesful");
  }
}

void delete_element(int arr[])
{
  int index,i;
  if(count==0)
  {
    printf("Empty array");
  }
  else
  {
    printf("Enter Index:");
    scanf("%d",&index);
    for(i=index;i<LEN;i++)
    {
      arr[i]=arr[i+1]
    }
    count--;
    printf("Delete succesful.");
  }
}

void search(int arr[])
{
  int value,flag=0,i;
  printf("Enter value:");
  scanf("%d",&value);
  for(i=0;i<count;i++)
  {
    if(arr[i]==value)
    {
      printf("Value %d is found at index:",value,index);
      flag=i;
    }
  }
  if(!flag)
    printf("Value not found");
  printf("Search Complete");
}

} //                           declaration missing ; here
  • 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-05-15T16:31:28+00:00Added an answer on May 15, 2026 at 4:31 pm

    For one, you are missing a semicolon here:

    for(i=index;i<LEN;i++)
    {
        arr[i]=arr[i+1] // Missing semicolon!
    }
    

    You also did not close your main function with a right curly brace. Move the curly brace at the end of the program to before your implementation of print().

    One more point about readability. Make sure to indent after open braces and inside if statements. The following lines are confusing as it’s unclear that only the first printf is part of the if statement.

    if(!flag)
    printf("Value not found");
    printf("Search Complete");
    

    Instead, indent the second line, and for even more clarity, you might want to use braces. LIke so:

    if(!flag) 
    {
        printf("Value not found");
    }
    printf("Search Complete");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 492k
  • Answers 492k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Use a negated class including \W or \S. /[^\W_]/ #… May 16, 2026 at 10:27 am
  • Editorial Team
    Editorial Team added an answer Try it with assert_no_match(/^(tel|fax|web)/i, "www.jehall.co.uk") That should work. Otherwise you're… May 16, 2026 at 10:27 am
  • Editorial Team
    Editorial Team added an answer Yes there is, check out Javadoc. http://en.wikipedia.org/wiki/Javadoc You probably have… May 16, 2026 at 10:27 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have the two images below. They are the same image, with one having
I'm having a graphics problem on drawing lines in Flash Player, where two lines
I have a custom control that needs a minor adjustment when running on XP
I have a variety of small C# winforms applications (though this should apply equally
i am having two list box which perform add remove item functionality which are
Internet explorer seems to not handle having two divs both with different semi-transparent backgrounds.
For every project it's like having two parts: the Rails application and then all
I have 3 django models (simplified for this example): class Fighter (models.Model): name =
I have two functions : void foo(const char * p) and template<size_t T_Size> void
I just finished building my program, but I noticed that vb.net (2010) creates two

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.