0

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

3
Contributors
2
Replies
3
Views
10 Years
Discussion Span
Last Post by WaltP
0

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

0

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?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.