Thread: seg fault from std::list.push_back()

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    VA National Guard The Brain's Avatar
    Join Date
    May 2004
    Location
    Manassas, VA USA
    Posts
    903
    i think you can only push back 'list' objects into your vector. ('r' is of type int...)
    • "Problem Solving C++, The Object of Programming" -Walter Savitch
    • "Data Structures and Other Objects using C++" -Walter Savitch
    • "Assembly Language for Intel-Based Computers" -Kip Irvine
    • "Programming Windows, 5th edition" -Charles Petzold
    • "Visual C++ MFC Programming by Example" -John E. Swanke
    • "Network Programming Windows" -Jones/Ohlund
    • "Sams Teach Yourself Game Programming in 24 Hours" -Michael Morrison
    • "Mathmatics for 3D Game Programming & Computer Graphics" -Eric Lengyel

  2. #2
    Registered User
    Join Date
    Oct 2005
    Posts
    5
    Quote Originally Posted by The Brain
    i think you can only push back 'list' objects into your vector. ('r' is of type int...)

    The syntax looks alright to me. r is pushed back on the i'th list x[i].

    - EJ

  3. #3
    Registered User
    Join Date
    Sep 2005
    Posts
    41
    what is m[i]? and what is n? You're getting a seg fault probably because you for loop is trying to put a value in some space that is not allocated.

  4. #4
    Registered User
    Join Date
    Apr 2003
    Posts
    2,663
    How big are 'n' and m[i]?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting a seg fault
    By ammochck21 in forum C Programming
    Replies: 11
    Last Post: 01-23-2009, 05:27 AM
  2. Seg Fault in Compare Function
    By tytelizgal in forum C Programming
    Replies: 1
    Last Post: 10-25-2008, 03:06 PM
  3. seg fault at vectornew
    By tytelizgal in forum C Programming
    Replies: 2
    Last Post: 10-25-2008, 01:22 PM
  4. weird seg fault
    By Vermelho in forum C Programming
    Replies: 3
    Last Post: 05-10-2008, 08:27 PM
  5. Seg Fault Problem
    By ChazWest in forum C++ Programming
    Replies: 2
    Last Post: 04-18-2002, 03:24 PM