View Single Post
  #2 (permalink)  
Old August 14th, 2010, 03:12 AM
sh_erfan sh_erfan is offline
Authorized User
 
Join Date: Nov 2009
Posts: 26
Thanks: 1
Thanked 1 Time in 1 Post
Post

After assigning a string value to a variable of type char*, you use index to access it's elements. Just like array of chars.
Code:
char* letters2="ABCDE";
letters2[0]='X';
Although letter2 itself is a pointer to the first element of the string, you can't change it's value using asterisk(*) operator.
you can test this simply by printing memory addresses in a console application..

Hope that helped...
Reply With Quote