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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T21:21:11+00:00 2026-05-29T21:21:11+00:00

Hello I’m 17 and trying to learn how to code. I am having trouble

  • 0

Hello I’m 17 and trying to learn how to code. I am having trouble debugging this section of code and would appreciate some help.

bool checkifwin(char grid[3][3], char player)
{
    if (checkverticle(char grid[3][3], char player) 
        || checkhorizontal(char grid[3][3], char player)
        || checkdiagonal( grid[3][3], player) 
       return true;
    else
       return false;
};

It says expected primary-expression before char.

  • 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-29T21:21:12+00:00Added an answer on May 29, 2026 at 9:21 pm

    checkverticle() is a call to a function not a declaration so you don’t need the “char”s.

    bool checkifwin(char grid[3][3], char player)
    {
        if ( checkverticle(grid, player) || 
             checkhorizontal(grid, player) || 
             checkdiagonal( grid, player) return true;
        else return false;
    };
    

    Just some coding advice. In my opinion:

    bool func()
    {
        if (expr)
            return true;
        else
            return false;
    }
    

    Is not great style. I’d suggest refactoring it to:

    bool func()
    {
        bool result = false; // This just makes it clear the expected default.
        // You could even go as far as
        // bool result = expr  or event return expr; - although I suggest sticking with a
        // variable in case you need to debug.
        result = expr; // e.g. result = checkVert() || checkHoriz() || checkDiag();
        return result;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello Guys I am trying to figure out why i am gettings this error
Hello I am trying to create a stacked barplot using the following code: test
Hello guys can you please help me with this problem. When a simple image
Hello I am trying to do a SOAP request here is my code: #
Hello i have this code var queue = new BlockingCollection<int>(); queue.Add(0); var producers =
Hello I need some help with a bug in Internet Explorer 9. I am
Hello I'm trying to write some values to my SQL through the C# WinForm
Hello can anybody solve this please I'm creating the object in the action class
Hello I am working with a simulator that uses rcS scripts to boot, this
Hello everyone i am trying to format the input number range with php number_format

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.