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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T17:01:29+00:00 2026-06-11T17:01:29+00:00

i know how to create a stack of vectors or int ,etc. But i

  • 0

i know how to create a stack of vectors or int ,etc. But i dont know how to create a stack of a multidimentional arrays t[n][n] . Whats the way to implement it?
this is my actual implementation which its not working.

char map[20][20];
stack<map> soluciones;

Edit:

I think due my english most of you didnt undestand my question. Imagine i got some kind of a Game map. I am saving each multidimentional array on the stack. Thats my objective saving the map on a stack

Edit 2: im using Visual Studio 2010 Windows form application

  • 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-11T17:01:31+00:00Added an answer on June 11, 2026 at 5:01 pm

    In your code example, you use map (the name of your variable) in place of where a type name must stand (in stack<map> template instantiation). However, it won’t work, not even if you use the proper type name (in this case you’d have to use typedef, e.g. typedef char TwoDimCharArray[20][20] and then try std::stack<TwoDimCharArray>:

    There is still the problem that arrays don’t have a default constructor (which std::stack expects); therefore, std::stack cannot be made to directly contain arrays; you’d have to wrap the array inside a class or struct (which can have a default constructor), e.g.:

    class TwoDimCharArray
    {
    public:
        // omit if there's nothing to initialize in map, then the
        // compiler-generated constructor will be used
        TwoDimCharArray()
        {
            // ... initalize map values
        }
        // ... provide access methods to map
    private:
        char map[20][20];
    };
    
    std::stack<TwoDimCharArray> soluciones;
    

    Or use Boost.Array or C++11 std::array stuff! If these are available, they are definitely the better and easier choice!

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

Sidebar

Related Questions

I know I can create a List<T> from IEnumerable<T> by doing myEnumerableCollection.ToList() , but
I know how to create a job dynamically from this create-sql-server-job-automatically The issue I
I know how to create small data driven websites but want to get an
I stack with this, I'm trying to create application using TabLayout. I have 3
I know that this is not a programming related question but what is the
i know there must be thousands of threads like this, but the internet and
I actually want to create a new local. I know it sounds dubious, but
I'm trying to implement a simple stack. It works fine on MacOSX but crashes
I don't know when it happened but I'm getting this error NoMethodError (undefined method
What kind of skills should a WPF developer know to create MVVM applications? Things

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.