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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T08:02:19+00:00 2026-06-02T08:02:19+00:00

struct air_message { deque<int> path; int dest_region; int dest_airport; int next_region; int msg_from; };

  • 0
struct air_message
{    
    deque<int> path;

    int dest_region;
    int dest_airport;
    int next_region;

    int msg_from;
};

I have this structure. And I have this code

deque<int> p = graph->get_shortest_path(source_region, dest_region);                    
m->path = p;

At this line

m->path = p;

I am getting a segmentation fault error (‘m’ is a pointer of the air_message structure).

  • 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-02T08:02:20+00:00Added an answer on June 2, 2026 at 8:02 am

    You need to examine the code that allocates m. Your problem here isn’t with the deque itself, it’s because m is not a valid pointer.

    For example, if the only code you have is:

    struct air_message *m;
    deque<int> p = graph->get_shortest_path (blah, blah);                    
    m->path = p;
    

    then yes, m will not be valid.

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

Sidebar

Related Questions

struct Foo{ int _a; this(int a){ _a = a; } int opCall(int b){ return
struct Foo { Foo(int i) { ptr = new int(i); } ~Foo() { delete
struct X{}; template<class T> decltype(X() == int()) f(T const&){ return true; } int main(void)
struct { char a; int b; } x; Why would one define a struct
struct SomeStruct { int a; int b; }; SomeStruct someFn( int init ) {
struct Div { int i; int j; }; class A { public: A(); Div&
struct struct0 { int a; }; struct struct1 { struct struct0 structure0; int b;
struct A { int i; }; ... A *p = (A*) (8); // or
struct fraction { int num; int denum; } pi; pi.num=22; pi.denum=7; ((fraction*)&(pi.denum))->num=12; cout <<
struct Record_node* Sequential_search(struct Record_node *List, int target) { struct Record_node *cur; cur = List->head

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.