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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T09:43:21+00:00 2026-06-04T09:43:21+00:00

I am writing a small game for an assignment and it requires using a

  • 0

I am writing a small game for an assignment and it requires using a map, I have successfully put the map into a 2d array, but now working further into the assignment I found I need to access the array Map[][] in another function. I have tried to get it to work but failed. The error I get with g++ is ” error: ‘Map’ is not a type ” Any help would be appreciated.

I have searched but either I am terrible at using the search engine or I couldn’t find anything specific to this error.

const int MapSZ = 10; //In Global
int Map[MapSZ][MapSZ]; // Also Global

void GetMap(ifstream&, int); //Getting the map (Proto)

GetMap(fin, Map[MapSZ][MapSZ]); //In the main function.

void GetMap(ifstream& fin, Map[MapSZ][MapSZ]) //Inserting the map into an array
  • 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-04T09:43:22+00:00Added an answer on June 4, 2026 at 9:43 am

    If Map[MapSZ][MapSZ] is defined as a global, as your comment states (i.e. it is defined in main.cpp but outside of the main function), there is no need to pass it as a parameter to GetMap. You could simply do something like

    void GetMap(ifstream& fin); //proto
    
    int main(int argc, const char * argv[]) {
        GetMap(fin);
    }
    
    void GetMap(ifstream& fin) {
        //some code that uses Map[MapSZ][MapSZ]
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have am writing a small game using Applet. I want to be able
I am writing a small shooting game using cocos2d. It's working good in simulator.
I am writing a small game by using cocos2d. It is a shooting game.
I am currently considering writing a small game. It is essentially a map where
I'm writing a small sudoku game/solver in Linux using python with TUI (not GUI,
I have writing a small shooting game in cocos2d. Winning the game is to
I am writing a small Android game using a SurfaceView class. The outline of
I am writing a small game engine for XNA. Right now my entity manager
I have the beginnings of a small multiplayer game that I'm writing in python
I am writing a colouring game for small children, where I have a black

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.