you can not change that
it will give error if you will try to change
if want to modify
you should declare it as
char a[] = "pilani"

On Sat, Jun 25, 2011 at 12:47 PM, oppilas . <jatka.oppimi...@gmail.com>wrote:

> I was reading about how char *arr is different from char arr[].
> Now, as in char *arr="Pilani",
> arr stores the base address of the memory block reserved for Pilani.
> How, can I change the any character at that particular memory block?
> arr[0] ='T' gives error.
>
> #include<iostream>
> using namespace std;
> int main(){
>    char *p="Pilani";
>   // p[0]='K'// does not work.
>   // *(&p[0])='s'; //does not work;
>    cout<<p[0]<<"  "<<(void *)p<<"  \n";
>    return 0;
> }
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
Sunny Aggrawal
B-Tech IV year,CSI
Indian Institute Of Technology,Roorkee

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to