cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
Array with String
Array with String
Nov 1, 2016 at 4:29pm UTC
fsfh60
(10)
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
Nov 1, 2016 at 7:28pm UTC
Nov 1, 2016 at 5:43pm UTC
AbstractionAnon
(6954)
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.