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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:59:06+00:00 2026-06-13T13:59:06+00:00

void change_degree(vector<int> &nodes, map<int, vector<int> > &edges, int vertex){ map<int, vector<int> >::iterator ite; ite

  • 0
void change_degree(vector<int> &nodes, map<int, vector<int> > &edges, int vertex){
    map<int, vector<int> >::iterator ite;
    ite = edges.find(vertex);
    vector<int> temp = (*ite).second;
    vector<int>::iterator it;
    for(it = temp.begin(); it != temp.end(); it++){
        cout << *it;
        if(nodes[*it + 1] > 1)
            nodes[*it + 1]++;
    }
}  

This function is producing error

*** glibc detected *** ./a.out: munmap_chunk(): invalid pointer: 0x09c930e0 ***  

Can someone tell me why is it coming and what it means?
Thanks in advance.

  • 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-13T13:59:07+00:00Added an answer on June 13, 2026 at 1:59 pm

    Well, one issue I see is that you’re not checking to see if vertex was actually found in edges. You are probably dereferencing memory you don’t own.

    void change_degree(vector<int> &nodes, map<int, vector<int> > &edges, int vertex){
        map<int, vector<int> >::iterator ite = edges.find(vertex);
        if (ite != edges.end()) {  // <-- this is what you're missing
            vector<int> temp = (*ite).second;  // <-- this is probably where you're dying
            vector<int>::iterator it;
            for(it = temp.begin(); it != temp.end(); it++){
                cout << *it;
                if(nodes[*it + 1] > 1)  // <-- you could also be crashing here
                    nodes[*it + 1]++;
            }
        }
    }
    

    Next time, try running your app through GDB, and check your stack trace.

    Edit: another possibility is that you’re indexing into nodes incorrectly. Check that nodes[*it + 1] is valid.

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

Sidebar

Related Questions

Lets say this is the C++ code: void change(int& x){ x++; } or void
The code states: void (* log_msg)(char *msg) =printf; void change_and_log(int *buffer, int offset, int
class PassingRefByVal { static void Change(int[] pArray) { pArray[0] = 888; // This change
Between formal parameters in a function definition, like: void change (int *s) { s[0]
Please consider the following example: class Example { int &_m; public: /** * An
Is there any way to make this work in Java? public static void change(List<?
I do not want to change the public static void ... String[] args part
i'm programming with opengl and i want to change the camera view: ... void
I have a bookmarklet: var b=document.getElementsByClassName('textinput')[0]; b.value=' (Christiansburg)'; var f=document.createEvent(HTMLEvents); f.initEvent('change',true,true); b.dispatchEvent(f); void(0); This
AFunc changes what was sent to it, and the printf() outputs the changes: void

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.