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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T18:17:58+00:00 2026-06-04T18:17:58+00:00

How do I use an array of character arrays when my setup looks like

  • 0

How do I use an array of character arrays when my setup looks like this:

In classes.h

    namespace foomaker
    {
        class foo
        {
            const char  **mystringarray;

            bool ipitythefoo ();

        };
    }

In foo.cpp
#include classes.h

    namespace foomaker
    {

        bool foo::ipitythefoo()
        {
            *mystringarray[] = {"Mr. T","Gold Chains","Mohawks"};

            return false;
        };
    }

Compiler is throwing errors:

    1>.\foofactory.cpp(5) : error C2059: syntax error : ']'
    1>.\foofactory.cpp(5) : error C2143: syntax error : missing ';' before '{'
    1>.\foofactory.cpp(5) : error C2143: syntax error : missing ';' before '}'

Or is this even possible?

Unable to use strings, maps, or vectors for this.

The end-result is that this will be for error strings that I need to get by position number. The error strings are specific to this class.

Thanks

  • 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-04T18:18:00+00:00Added an answer on June 4, 2026 at 6:18 pm

    What you want to do is not possible. You are trying to re-initialize an array, and that cannot be done. Perhaps, given that your use case is for error strings, you can do something like this:

        bool foo::ipitythefoo()
        {
            static const char* actualstringarray[] = {"Mr. T","Gold Chains","Mohawks"};
            *mystringarray = actualstringarray;
    
            return false;
        };
    

    But then, it’d make more sense for an array of error strings to be static to begin with.

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

Sidebar

Related Questions

So, basically I'm trying to use a char array for a character sprite for
I have a character array like this : +---+---+---+ |53.|.7.|...| |6..|195|...| |.98|...|.6.| +---+---+---+ I
Is it okay to use array without single or double quotion like $array[key]? I
I have rjecnik.txt file that looks like this mate sime, jure stipica gujo, prvi
I am trying to create a pacman-like game. I have an array that looks
I have a character array of length 32 and would like to take certain
I'm trying to use Array.select to separate out, and then delete, strings from a
I am a beginner in Java and is learning to use array. I understand
I'm making a top-bottom queue. Do I use array or arraylist?
I use an array for storage of functions which needs to be called in

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.