C++ simple arrays and pointers question
- by nashmaniac
So here's the confusion, let's say I declare an array of characters
char name[3] = "Sam";
and then I declare another array but this time using pointers
char * name = "Sam";
What's the difference between the two? I mean they work the same way in a program. Also how does the latter store the size of the stuff that someone puts in it, in this case 3 characters?
Also how is it different from
char * name = new char[3];
If those three are different where should they be used I mean in what circumstances?