0

I want to pass a string array to the function like this int function (string text[]) . But the IntelliSense says that identifier string is undefined . Why can't I pass a string array like usually I do with int arrays ?

3
  • 1
    IntelliSense is not a definitive say on whether your code works or not, what happens if you compile it? Commented Jun 19, 2013 at 18:48
  • Do you have #include <string> and using std::string? Commented Jun 19, 2013 at 18:48
  • Because int is a built-in datatype while string is a datatype created using built-in types and exposed via the standard library. Commented Jun 19, 2013 at 19:05

1 Answer 1

2

Are you using std::string or just string? Try adding using std::string if you don't have it in your code.

Sign up to request clarification or add additional context in comments.

4 Comments

I have written using namespace std;
What about #include <string>?
@Sam379 Don't do using namespace std, see why here.
now everything is OK . I haven't included string library . Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.