I want to know the difference between char pointer and pointer to char..? Are they same? If no what is the difference?
-
I'd say "same". If you're in C++ land, using a "const" qualifier, then there are subtle distinctions in your declaration for "pointer is const" vs. "what's pointed at is const". But as far as your question: the two terms are equivalent. IMHO..paulsm4– paulsm42012-07-30 06:06:07 +00:00Commented Jul 30, 2012 at 6:06
Add a comment
|
6 Answers
This question might make more sense if you backed it up with example code. As far as I'm concerned they mean the same thing, but I only ever think of "char pointer".
What I think you might mean is this:
char c = 'A';
char *pc = &c; // <-- "pointer to char"?
char *p = new char [50]; // <-- "char pointer"?
In fact, pc and p above are both char pointers. They can both be used as arrays, although addressing anything other than the zeroth element of pc is going to cause problems.