i don't know how to fix this error can any one help me

here's my code:

StringStack::StringStack(string value)
{
	stackArray = new string[value];
	stackVal = value;
	top = -1;
}

and the erro says:

error C2440: 'initializing;: cannot convert from 'std::string; to size_t'

what does this mean

and another error is:

error C2440: '=':cannot convert fro 'std::string' to 'int'

If anyone knows how to fix this please help

thank in advance,

Rodolfo Gracia

In your array declaration stackArray = new string[value]; , you are trying to use a string (value) where you need a constant integer. That is, there should be a number inside the square brackets.

It's not clear here, but if stackVal is also an int, again, you cannot assign a string to it.

In the future, it would be helpful if you identified the specific line the error messages pertain to.

What information is "value" supposed to provide to this function?

Val

i don't know how to fix this error can any one help me

here's my code:

StringStack::StringStack(string value)
{
	stackArray = new string[value];
	stackVal = value;
	top = -1;
}

top is undefined.
stackVal is undefined.
No idea what line the errors are on.
What can we say?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.