?
Solved

simple stl vector problem

Posted on 2003-03-08
2
Medium Priority
?
207 Views
Last Modified: 2010-04-17
heres  a little sniplet--

void main()
{
vector<char> list;
char string[] = "whatever";
list.push_back(string);
list.clear();
}

debugger is giving me "cannot conver from char to cont char&"
can someone set me straight here,obviously im not declaring the vector right.
0
Comment
Question by:tollunman
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 2

Expert Comment

by:antonsigur
ID: 8095016
yes, you should do,
const char * string = "whatever"
0
 

Accepted Solution

by:
eranborovik earned 80 total points
ID: 8097055
The vector type should be changed to vector<const char *>
to do such thing. Also some compilers may complain because
of the assignment (char string[] = "whatever";)
To do it according to the strictest C++ rules, you must change the string type to (const char *) as well.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
Six Sigma Control Plans
Starting up a Project

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question