Thread: char[] vs char*
View Single Post
Old Apr 5th, 2008, 8:21 PM   #4
Ancient Dragon
PFO God In Training
 
Ancient Dragon's Avatar
 
Join Date: Jun 2005
Location: near St Louis, MO. (USA)
Posts: 529
Rep Power: 4 Ancient Dragon is on a distinguished road
Re: char[] vs char*

when NOT used as a parameter to a function always use the array notation if you think you will change any of the characters in the array.

A pointer probably points to somewhere in read-only memory so it can not be changed. The pointer notation should really be made const so that you can't change the string to which it points.
__________________
I Like Ike. Vote for Dwight Eisenhower this November.
--This message brought to you by the the Procrastinators Club Of America.
Ancient Dragon is offline   Reply With Quote