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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T22:33:34+00:00 2026-05-12T22:33:34+00:00

expected unqualified-id before ‘{‘ Where is this error on my code? Thanks everyone! #include

  • 0

expected unqualified-id before ‘{‘

Where is this error on my code? Thanks everyone!

#include <iostream>

using std::cout;
using std::endl;

//function prototypes
void findsmallest (int[], int &); 
void findsmallest  (int scores [], int & min);

int main()
{
    //declare variables
    int smallest = 0;
    int scores[20] = { 90, 54, 23,  75, 67,
                       89, 99, 100, 34, 99, 
                       97, 76, 73,  72, 56, 
                       73, 72, 65,  86, 90 };
    findsmallest(scores, smallest);                   
    return 0;

    //call function find smallest
    findsmallest (scores, smallest);                   

    cout << "Minimum value in the array is " << smallest << endl;

    system ("pause");
    return 0;
}

//function definition

void findsmallest(int scores [], int & min);
{

    min = scores[0];
    int i;

    for(i = 0; i < 20; i++)
    {
        if(scores[i] < min)
        {
            min = scores[i];
        }
    }
}


//end display findsmallest
system ("pause");
return 0;
  • 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-12T22:33:35+00:00Added an answer on May 12, 2026 at 10:33 pm

    The error is in the first line of the findsmallest() function definition. Get rid of the semicolon and it should work (barring other errors in the code — I didn’t check it for correctness).

    void findsmallest(int scores [], int & min); <-------semicolon
    {
    

    vs

    void findsmallest(int scores [], int & min) <--------no semicolon
    {
    

    The error is telling you that the open brace ({) that follows the semicolon is lacking a preceding class/struct/union/function declaration, so the compiler doesn’t know what to do with it. Remove the semicolon and now the compiler knows that it’s the body of a function definition.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 225k
  • Answers 225k
  • 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 After playing with the code I have received from ZZ… May 13, 2026 at 12:55 am
  • Editorial Team
    Editorial Team added an answer Twitter uses in memory database and MySQL is just for… May 13, 2026 at 12:55 am
  • Editorial Team
    Editorial Team added an answer Easy, use a VisualBrush. Just point the VisualBrush's Visual property… May 13, 2026 at 12:55 am

Related Questions

Please bear with me, I'm just learning C++. I'm trying to write my header
I am learning a book on data structures, and complied their node in linked
I get the following errors when trying to compile the below code using g++.
I have the following code that tries to enumerate strings. #include <string> #include <iostream>
Can somebody explain to me why the following works: template<class T> class MyTemplateClass {

Trending Tags

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

Top Members

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.