From: Manni Heumann Newsgroups: comp.os.msdos.djgpp Subject: Re: newbie: pointers/vectors confusion w/ DJGPP Date: 23 Jul 2003 11:04:01 GMT Lines: 19 Message-ID: References: <87752c88 DOT 0307230158 DOT 15540458 AT posting DOT google DOT com> NNTP-Posting-Host: edgar.dhcp.uni-bielefeld.de (129.70.100.230) X-Trace: news.uni-berlin.de 1058958241 16960132 129.70.100.230 (16 1428 [54749]) User-Agent: Xnews/06.02.16 X-Face: "c)Go+A65AgR*9'!B)BMLM$kYg6HDG!_g'DAsj*ALo%=kp{X&abs&t\G0F~*r?VRj#|4=6)M.RJPnD]Ql:B<-7A^EAYFpDpZRMoJy?80^3B3b AT DXb%MTyOD.*4wu&Xt6o*+6`r5E X-Converter: MorVer Version 1.0.305 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Tom Weston wrote: > vector *demand; > > for (int i=0; i<10; ++i) > { > demand->push_back(7); > } > I would have thought that this would crash. You are using the push_back() method on a non-existing object. Your pointer is never initialized so it doesn't point anywhere where a push_back() method can be found. Why use a pointer to a vector instead of just a vector? Manni