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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T09:41:58+00:00 2026-06-05T09:41:58+00:00

I’m trying to access the values of a multidimensional array with two integers. The

  • 0

I’m trying to access the values of a multidimensional array with two integers. The array is declared in another source file.
I’m using an extern declaration at the top of the problem source file.

In the file where it’s declared, I can access the values.
However, when I copy and paste the same line of code over, the compiler informs me that the expression must be a pointer to a complete object type.

I’m new to C and pointers, so I don’t really know what’s going on.
I would appreciate any ideas.

extern struct piece board[8][8];


void move()
{
    
    char row;
    int column;
    int rowNumber = 0;
    printf("row: ");
    scanf("%c",&row);
    fflush(stdin);
    printf("column: ");
    scanf("%d",&column);
    column--;
    switch(row)
    {
    case 'A': rowNumber = 0; break;
    case 'B': rowNumber = 1; break;
    case 'C': rowNumber = 2; break;
    case 'D': rowNumber = 3; break;
    case 'E': rowNumber = 4; break;
    case 'F': rowNumber = 5; break;
    case 'G': rowNumber = 6; break;
    case 'H': rowNumber = 7; 
    }
    printf("\n your row is %d and column is %d",rowNumber,column);
    

     struct piece temp = &board[rowNumber][column];
    
}

and the array itself:

struct piece board[8][8] = {{{0,0,blackRook,"Rook"},{0,1,blackKnight,"Knight"},         {0,2,blackBishop,"Bishop"},{0,3,blackQueen,"Queen"},{0,4,blackKing,"King"}, {0,5,blackBishop,"Bishop"},{0,6,blackKnight,"Knight"},{0,7,blackRook,"Rook"}},
          {{1,0,blackPawn,"Pawn"}, {1,1,blackPawn,"Pawn"},{1,2,blackPawn,"Pawn"},{1,3,blackPawn,"Pawn"},{1,4,blackPawn,"Pawn"},{1,5,blackPawn,"Pawn"},{1,6,blackPawn,"Pawn"},{1,7,blackPawn,"Pawn"}},
                            {0},{0},{0},{0},


                             {{6,0,whitePawn,"Pawn"},{6,1,whitePawn,"Pawn"},{6,2,whitePawn,"Pawn"},{6,3,whitePawn,"Pawn"},{6,4,whitePawn,"Pawn"},{6,5,whitePawn,"Pawn"},{6,6,whitePawn,"Pawn"},{6,7,whitePawn,"Pawn"}},
                            {{7,0,whiteRook,"Rook"},{7,1,whiteKnight,"Knight"},{7,2,whiteBishop,"Bishop"},{7,3,whiteQueen,"Queen"},{7,4,whiteKing,"King"},{7,5,whiteBishop,"Bishop"},{7,6,whiteKnight,"Knight"},{7,7,whiteRook,"Rook"}}};

Sorry about the formatting, it looks better in Visual Studio.
The first two and last two arrays are filled with the struct piece – and the rest is 0.
The empty values don’t seem to be causing any problems anywhere else in my code.

EDIT – here is the piece definition:

struct piece
{
    int row;
    int column;
    int weight;
    char name[20];

};
  • 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-05T09:41:59+00:00Added an answer on June 5, 2026 at 9:41 am

    Apart from the fact that &board[r][c] is of type struct piece * and not struct piece you also need to include the header file which defines piece. The compiler is telling you that it has not enough information about struct piece.

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

Sidebar

Related Questions

I am trying to render a haml file in a javascript response like so:
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I am using parse_ini_file to read the contents of a file however it is
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function

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.