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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T09:22:21+00:00 2026-05-15T09:22:21+00:00

Declared a map early on: map<char*,char*> rtable; // used to store routing information Now

  • 0

Declared a map early on:

map<char*,char*>    rtable; // used to store routing information

Now I’m attempting to display the contents of the map:

void Routes::viewroutes(){
    typedef map<char*, char*>::const_iterator iter;
    for (iter=rtable.begin(); iter != rtable.end(); ++iter) {
        cout << iter->second << " " << iter->first << endl;
    }
}

Receiving the error “expected primary-expression before ‘!=’ token and for ‘->’ token. Can’t seem to understand the error I’m making here. Any ideas?

  • 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-15T09:22:22+00:00Added an answer on May 15, 2026 at 9:22 am

    iter is a type in your code. Should be a variable.

    typedef map<char*,char*> my_map_t;  // alias for a specialized map
    
    // declare a variable of needed type
    my_map_t    rtable;
    
    // declare iter of type my_map_t::const_iterator
    for (my_map_t::const_iterator iter=rtable.begin(); iter != rtable.end(); ++iter) {
        cout << iter->second << " " << iter->first << endl;
    }
    // scope of the iter variable will be limited to the loop above
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a map of pointer to member declared as : std::map<char, T (Operand::*)(const
I have a std::map that is used by multiple threads to store data. The
I have declared the following method: private void mockInvokeDBHandler(Map<String, Object>... rows) { List<Map<String, Object>>
I have declared an associative array and now want to print it: #include <map>
I have a map declared as follows: map < string , list < string
My goal is to store all the keys of a map (first item) to
I have my map declared in xaml like this: <my:Map Height=497 CredentialsProvider=key HorizontalAlignment=Left Margin=6,104,0,0
I tried to create a win32 dll using c++. It has a map declared
My map needs to display RED pins for Venues, and BLUE pins for Parking
I have declared a map like this map<long long, list<SoundInfo *> > m_soundListMap; and

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.