cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Lounge
beginner
beginner
May 31, 2011 at 5:54am UTC
ramthapa
(1)
hi can any one tell me what is wrong with this code? thanks!
const int SIZE = 7;
string owners[SIZE] = {"Jack", "Jill", "Mary", "Adam","Mottu"};
string * const streetX = &owners;
*(streetX + 1) = "Peter";
cout << "The owners of the houses in StreetX are "<<endl;
for(int i=0; i< SIZE; i++)
cout<< *(streetX + i)<< endl;
May 31, 2011 at 6:30am UTC
Zhuge
(4664)
This would be better suited to the Beginners section. And it sounds quite like homework. What progress have you made on it yourself?
May 31, 2011 at 8:47am UTC
hamsterman
(4538)
Indeed. You can move it yourself through edit button.
The problem is that you don't know that the type of owners is.
Hint: a[b] is equivalent to *(a+b), so what is a (if b is an integer) ?
Topic archived. No new replies allowed.