Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Sep 6th, 2005, 2:43 AM   #1
bingoelzouhery
Newbie
 
Join Date: Jan 2005
Posts: 6
Rep Power: 0 bingoelzouhery is on a distinguished road
Question Push_back() "Vectors in C++ "

hi everybody
i am afraid that i have a problem in using vectors, what i am doing is creating a vector of type struct and add Structs in it there is no compilations errors but it just dont allow adding in it i tried to much but still dont want to add in it so plz anyone can help send me
thanks all

thats what i did

vector<Symbol> SArr(length); //Symbol is a struct
SArr.push_back(S1[0]); //S1 is an array of struct
bingoelzouhery is offline   Reply With Quote
Old Sep 6th, 2005, 3:27 AM   #2
grumpy
Programming Guru
 
grumpy's Avatar
 
Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,260
Rep Power: 5 grumpy will become famous soon enough
What do you mean wen you say it "won't allow"? Or, to put it another way, how did you determine you have a problem?

As is, your code should not cause any problems unless you've done something strange in code you haven't shown. Your example is also incomplete. Try giving a small but COMPLETE example which illustrates your problem. And wrap your code in code tags, so th code is laid out better.
grumpy is offline   Reply With Quote
Old Sep 6th, 2005, 5:00 AM   #3
stevengs
Professional Programmer
 
stevengs's Avatar
 
Join Date: May 2005
Location: Bad Nauheim, Germany
Posts: 436
Rep Power: 4 stevengs is on a distinguished road
A common problem is pointer and dereferencing confusion, which is why I ask: Is S1 possibly an array of pointers to structs? Or, is Symbol possibly defined as a pointer to a struct?

Just a guess. We need more information (code and compiler/runtime errors).

Is length != 0?
__________________
-Steven
"Is this a piece of your brain?" - Basil Fawlty
stevengs is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 6:29 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC