Re: [algogeeks] char *arr and char arr[]

2011-06-25 Thread sunny agrawal
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.comwrote: I was reading about how char *arr is different from char arr[]. Now, as in char

Re: [algogeeks] char *arr and char arr[]

2011-06-25 Thread hary rathor
sol 1 : #includeiostream using namespace std; int main(){ char arr[]=Pilani,*p=arr; p[0]='K';// does not work. *(p[0])='s'; //does not work; coutp[0] (void *)p \n; return 0; } sol 2 : #includeiostream using namespace std; int main(){ char *p=(char *)Pilani; p[0]='K';// does not

Re: [algogeeks] char *arr and char arr[]

2011-06-25 Thread sameer.mut...@gmail.com
May i know the reason please? On Sat, Jun 25, 2011 at 1:06 PM, hary rathor harry.rat...@gmail.com wrote: sol 1 : #includeiostream using namespace std; int main(){ char arr[]=Pilani,*p=arr; p[0]='K';// does not work. *(p[0])='s'; //does not work; coutp[0] (void *)p \n;