Array with String

Hello guys, I am working on an assignement but very confused why I am getting these error :

20 [Error] expected primary-expression before ']' token
45 [Error] declaration of 'arr' as array of references

Last edited on
Line 6: Must be const.

Line 11: Under what conditions do you think the second part of the conditional would ever be evaluated?

Line 11,28,48: What do you think sizeof(arr) is going to return? The compiler doesn't know how many entries are in arr[].

Line 21: You can't do a push_back() onto a simple array.

Line 33: i is out of scope.

Line 46,64: arrays of references are not legal.

Line 57: You have no array called names.

Line 68,70: names is undefined. Did you mean Name?

Line 70: You can't use erase on a simple array.

Suggestion: Use std::vector<string> instead of an array of strings.
http://www.cplusplus.com/reference/vector/vector/









Topic archived. No new replies allowed.