-9
#include <iostream>
#include <string>
using namespace std;
int main() {
string *ptr = new string("fff");
string * ptr1 = new string("ffffff");
cout << ptr << endl << ptr1 << endl;
}

how are both ptr and ptr1 different in their representation, does *ptr mean the same thing as *[space]ptr

Deb
  • 1,918
  • 1
  • 18
  • 18

1 Answers1

4

Yes it means the same thing. White space makes no difference in this case (or indeed, in most cases in C++).

Jonathan Potter
  • 36,172
  • 4
  • 64
  • 79
  • 2
    You should not answer such a question, you're beating a dead horse. I'd -1 you if I thought it would make you delete your answer but obviously it won't since you already got +4 from it. Shame. – syam Sep 26 '13 at 21:09
  • 3
    I didn't realise there was a rule against answering questions on SO. – Jonathan Potter Sep 26 '13 at 21:35
  • There is no rule against answering questions, but there is a clear rule about *duplicate* questions (it's even a full-blown close reason). If you had answered a duplicate question that comes up once in a blue moon I wouldn't have made any comment, but this one comes up several times per day. You're not doing favours to anyone by answering something they could find in a few seconds by themselves if they actually made any research effort, actually I believe this kind of answer is *detrimental* because it encourages laziness. Just my two cents. – syam Sep 26 '13 at 21:56
  • It wasn't marked as a duplicate when I answered it, in fact it hadn't even been down-voted. – Jonathan Potter Sep 26 '13 at 22:32