• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 212
  • Last Modified:

simple stl vector problem

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
tollunman
Asked:
tollunman
1 Solution
 
antonsigurCommented:
yes, you should do,
const char * string = "whatever"
0
 
eranborovikCommented:
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now